demo D195
Capability against a tolerance in htmx
Cp, Cpk, Pp and Ppk from one column declaration
grid.statistics.capability(col, { baseline })
This grid computes Cp, Cpk, Pp and Ppk from a single column declaration with its tolerance. It tells a quality engineer whether a process fits within its spec, straight from the readings, without exporting to a separate tool.
This is the htmx version. A server-rendered table is upgraded in place, so the page is readable before any script runs and gains the full grid when the module loads, which suits a progressively enhanced app.
The configuration
<link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.108.0/lattice-grid.min.css">
<!-- A real, server-rendered table: readable with JavaScript off. data-field on
each header names the column that cell becomes, and data-id on each row is
the key the grid carries it under. -->
<table id="process-capability-table" data-lattice-grid>
<thead>
<tr>
<th data-field="part">Part</th>
<th data-field="bore">Bore</th>
</tr>
</thead>
<tbody>
<tr data-id="1"><td>P001</td><td>10</td></tr>
<tr data-id="2"><td>P002</td><td>10.079</td></tr>
<tr data-id="3"><td>P003</td><td>9.98</td></tr>
<!-- the rest of the rows, rendered by your server -->
</tbody>
</table>
<pre id="out" style="margin-top: 12px"></pre>
<script type="module">
import { hydrateTable } from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/modules/htmx.esm.min.js';
// The markup carries the rows; a server-rendered table's column types are
// declared in the config hydrateTable takes. The grid replaces the table
// where it stood.
const grid = hydrateTable(document.getElementById('process-capability-table'), {
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 out = document.getElementById('out');
out.textContent = JSON.stringify(grid.statistics.capability('bore', { baseline: 20 }), null, 2);
</script>