demo D230
An SPC study: control, range, capability
A drifting process with limits fixed on the first thirty readings, so the drift breaks a rule rather than being absorbed
chart type: control · movingRange · capability
Loading a live grid…
The configuration
<script>
import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/lattice-grid.esm.min.js';
import createLatticeAction from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/modules/svelte.esm.min.js';
import { createChart } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/modules/charts.esm.min.js';
const lattice = createLatticeAction({ createGrid });
let controlEl, mrEl, capEl;
const config = {
rowKey: 'id',
columns: [
{ field: 'n', title: '#', type: 'number' },
// The tolerance is declared once, on the column; every SPC figure reads it.
{ field: 'bore', title: 'Bore', type: 'millimetres', spec: { lower: 9.95, upper: 10.05, target: 10 } },
],
rows, // measured parts, in the order they were made
// onGrid hands over the live grid the moment it is created. Every chart reads
// it, so all three follow the grid's filters and sort.
onGrid: (grid) => {
// baseline fixes the limits on the first 30 readings, so a later drift breaks
// a rule rather than widening the limits to absorb it.
createChart({ grid, container: controlEl, type: 'control', y: 'bore', baseline: 30, rules: 'nelson' });
createChart({ grid, container: mrEl, type: 'movingRange', y: 'bore' });
createChart({ grid, container: capEl, type: 'capability', y: 'bore' });
// The capability index against the declared tolerance, with the rule set applied.
const c = grid.statistics.capability('bore', { rules: 'nelson', baseline: 30 });
console.log(c.cpk, c.violations);
},
};
</script>
<svelte:head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/lattice-grid.min.css">
</svelte:head>
<div bind:this={controlEl} style="height: 220px"></div>
<div style="display: flex; gap: 12px; margin-top: 12px">
<div bind:this={mrEl} style="flex: 1; height: 200px"></div>
<div bind:this={capEl} style="flex: 1; height: 200px"></div>
</div>
<div use:lattice={config} style="height: 320px; margin-top: 12px"></div>