demo D204
Statistical process control
Control limits against spec limits, which are not the same thing
type: 'control', y, baseline
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">
<div id="app"></div>
<script type="module">
import React from 'https://esm.sh/react@18';
import { createRoot } from 'https://esm.sh/react-dom@18/client';
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/react.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({ React, createGrid });
const columns = [
{ field: 'part', title: 'Part', layout: { width: 110 } },
// The spec declares the tolerance; the control chart reads it.
{ field: 'bore', title: 'Bore', type: 'number', spec: { lower: 9.5, upper: 10.8, target: 10 } },
];
const rows = [/* machined bore measurements */];
function App() {
const gridRef = React.useRef(null);
React.useEffect(() => {
const grid = gridRef.current.grid;
// baseline sets the control limits over the first readings. The chart reads
// the live grid, handed back through the ref, so it follows every filter.
createChart({ grid, container: '#chart', type: 'control', y: 'bore', baseline: 20 });
}, []);
return (
<>
<div id="chart" style={{ height: '340px' }} />
<LatticeGrid
ref={gridRef}
rowKey="id"
columns={columns}
rows={rows}
style={{ height: '320px', marginTop: '14px' }}
/>
</>
);
}
createRoot(document.getElementById('app')).render(<App />);
</script>