demo D195
Capability against a tolerance
Cp, Cpk, Pp and Ppk from one column declaration
grid.statistics.capability(col, { baseline })
Loading a live grid…
The configuration
import * as ng from '@angular/core';
import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { createGrid } from '@toclocoinc/lattice-grid';
import '@toclocoinc/lattice-grid/css';
import createLatticeGrid from '@toclocoinc/lattice-grid/modules/angular';
const { LatticeGridComponent } = createLatticeGrid({ ng, 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 } },
];
@Component({
selector: 'app-root',
standalone: true,
imports: [LatticeGridComponent],
template:
'<lattice-grid [config]="grid" style="display:block;height:440px"></lattice-grid>' +
'<pre style="margin-top:12px">{{ out }}</pre>',
})
export class AppComponent implements AfterViewInit {
@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.
ngAfterViewInit() {
const grid = this.gridRef && this.gridRef.grid;
if (grid) this.out = JSON.stringify(grid.statistics.capability('bore', { baseline: 20 }), null, 2);
}
}
bootstrapApplication(AppComponent);