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
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/lattice-grid.min.css">
<style>
#control { height: 220px; }
#pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
#pair > div { height: 200px; }
#grid { margin-top: 12px; }
#grid > div { height: 320px; }
</style>
<div id="app"></div>
<script type="module">
import * as Vue from 'https://esm.sh/vue@3';
import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/lattice-grid.esm.min.js';
import createLatticeGrid from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/modules/vue.esm.min.js';
import { createChart } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/modules/charts.esm.min.js';
const LatticeGrid = createLatticeGrid({ vue: Vue, createGrid });
Vue.createApp({
components: { LatticeGrid },
data() {
return {
config: {
rowKey: 'id',
columns: [
{ field: 'n', title: '#', type: 'number', layout: { width: 80 } },
// 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
},
};
},
mounted() {
// The component exposes the live grid via a template ref. All three charts and
// the capability figure read that one instance.
const grid = this.$refs.grid.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: '#control', type: 'control', y: 'bore', baseline: 30, rules: 'nelson', title: 'Control chart, limits fixed on the first 30 readings' });
createChart({ grid, container: '#mr', type: 'movingRange', y: 'bore', title: 'Moving range' });
createChart({ grid, container: '#cap', type: 'capability', y: 'bore', title: 'Capability against the tolerance' });
// 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);
},
template: `
<div id="control"></div>
<div id="pair">
<div id="mr"></div>
<div id="cap"></div>
</div>
<div id="grid"><lattice-grid ref="grid" v-bind="config" /></div>
`,
}).mount('#app');
</script>