demo D212
Manufacturing and process in Svelte
A machined bore with a tolerance driving capability, drifting in one shift
spec · grid.statistics.capability
This is a machined-bore dataset with a tolerance driving a capability figure, and the process drifting within a single shift. It shows manufacturing data judged against its spec in real time, so a drift out of tolerance shows as it happens.
This is the Svelte version. A use action attaches the grid to a plain element, so no framework runtime is passed in and the component stays small, while the configuration is ordinary Svelte state.
The configuration
<script>
import { createGrid } from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/lattice-grid.esm.min.js';
import createLatticeAction from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/modules/svelte.esm.min.js';
const lattice = createLatticeAction({ createGrid });
let out = '';
const config = {
rowKey: 'id',
toolPanel: { side: 'left', panels: ['columns', 'filters', 'statistics'] },
columnDefaults: { filter: true },
columns: [
{ field: 'part', title: 'Part', layout: { pin: 'start', width: 120 } },
{ field: 'shift', title: 'Shift', filter: { type: 'set' } },
// The spec drives process capability and the control chart.
{ field: 'bore', title: 'Bore', type: 'millimetres', total: 'median',
spec: { lower: 9.5, upper: 10.8, target: 10 } },
{ field: 'speed', title: 'Spindle', type: 'rpm', total: 'avg' },
{ field: 'torque', title: 'Torque', type: 'torque', total: 'max' },
],
formatting: {
bore: [
{ id: 'b-out', when: { op: 'notBetween', value: 9.5, value2: 10.8 }, style: { background: '#fbeceb' } },
{ id: 'b-z', when: { op: 'zAbove', value: 2 }, style: { background: '#fff4e5' } },
],
},
rows,
// onGrid hands over the live grid the moment it is created. baseline fixes
// the limits on the first 40 readings, so a later tool-wear drift
// separates Cpk from Ppk rather than widening the limits to absorb it.
onGrid: (grid) => {
const report = () => {
out = JSON.stringify(grid.statistics.capability('bore', { baseline: 40 }), null, 2);
};
grid.on('filter:changed', report);
report();
},
};
</script>
<svelte:head>
<link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.108.0/lattice-grid.min.css">
</svelte:head>
<div use:lattice={config} style="height: 460px"></div>
<pre style="margin-top: 12px">{out}</pre>