Lattice Grid Buy a licence

demo D204

Statistical process control in Angular

Control limits against spec limits, which are not the same thing

type: 'control', y, baseline

This draws a statistical process control chart with control limits set against spec limits, which are not the same thing. It shows when a process is drifting out of its own normal behaviour, distinct from whether it meets the spec, so you catch a change early.

Building…
Loading a live grid…

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 { createChart } from '@toclocoinc/lattice-grid/modules/charts';
import { LatticeGridComponent, provideLattice } from '@toclocoinc/lattice-grid/angular';

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 */];



@Component({
  selector: 'app-root',
  standalone: true,
  imports: [LatticeGridComponent],
  template:
    '<div id="chart" style="height:340px"></div>' +
    '<lattice-grid [config]="grid" (grid-ready)="onGridReady()" style="display:block;height:320px;margin-top:14px"></lattice-grid>',
})
export class AppComponent {
  @ViewChild(LatticeGridComponent) gridRef!: LatticeGridComponent;

  grid = {
    rowKey: 'id',
    columns: columns,
    rows: rows,
  };

  // 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;
    // 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 });
  }
}

bootstrapApplication(AppComponent, {
  providers: [provideLattice({ createGrid })],
});