Lattice Grid Buy a licence

demo D195

Capability against a tolerance

Cp, Cpk, Pp and Ppk from one column declaration

grid.statistics.capability(col, { baseline })

Building…
Loading a live grid…

The configuration

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.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.28.0/lattice-grid.esm.min.js';
  import createLatticeGrid from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/modules/react.esm.min.js';

  const LatticeGrid = createLatticeGrid({ React, createGrid });

  const columns = [
    { field: 'part', title: 'Part', layout: { pin: 'start', width: 110 } },
    // The spec declares the tolerance; capability reads it.
    { field: 'bore', title: 'Bore', type: 'number', total: 'median',
      spec: { lower: 9.5, upper: 10.8, target: 10 } },
  ];

  const rows = [/* machined bore measurements */];

  function App() {
    const gridRef = React.useRef(null);
    const [out, setOut] = React.useState('');

    // capability reports Cp, Cpk and the rest against the column's declared spec,
    // read straight from the live grid through the ref.
    React.useEffect(() => {
      const grid = gridRef.current && gridRef.current.grid;
      if (grid) setOut(JSON.stringify(grid.statistics.capability('bore', { baseline: 20 }), null, 2));
    }, []);

    return (
      <>
        <LatticeGrid
          ref={gridRef}
          rowKey="id"
          columns={columns}
          rows={rows}
          style={{ height: '440px' }}
        />
        <pre style={{ marginTop: '12px' }}>{out}</pre>
      </>
    );
  }

  createRoot(document.getElementById('app')).render(<App />);
</script>