demo D195
Capability against a tolerance in Angular
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 Angular version. A standalone component takes the whole configuration through one config input, surfaces grid events as outputs, and exposes the live grid on a getter for anything the inputs do not cover.
The configuration
import { Component, ViewChild } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { createGrid } from '@toclocoinc/lattice-grid';
import '@toclocoinc/lattice-grid/css';
import { LatticeGridComponent, provideLattice } from '@toclocoinc/lattice-grid/angular';
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 } },
];
@Component({
selector: 'app-root',
standalone: true,
imports: [LatticeGridComponent],
template:
'<lattice-grid [config]="grid" (grid-ready)="onGridReady()" style="display:block;height:440px"></lattice-grid>' +
'<pre style="margin-top:12px">{{ out }}</pre>',
})
export class AppComponent {
@ViewChild(LatticeGridComponent) gridRef!: LatticeGridComponent;
out = '';
grid = {
rowKey: 'id',
columns,
rows: [/* machined bore measurements */],
};
// capability reports Cp, Cpk and the rest against the column's declared spec,
// read straight from the live grid. The grid is created once the view has
// rendered, so the live instance arrives on grid-ready rather than in
// ngAfterViewInit.
onGridReady() {
const grid = this.gridRef.grid;
this.out = JSON.stringify(grid.statistics.capability('bore', { baseline: 20 }), null, 2);
}
}
bootstrapApplication(AppComponent, {
providers: [provideLattice({ createGrid })],
});