Lattice Grid Buy a licence

demo D224

A production line

A measurement profile transpose, an out-of-tolerance list, spread by line, and Cpk in a tile against the column spec

profile · where · statistics.capability

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">
<style>
  #tiles { margin-bottom: 16px; }
  #batch > div { height: 320px; }
  #profile, #oot { margin-top: 16px; }
</style>
<div id="app"></div>

<script type="module">
  import * as Vue from 'https://esm.sh/vue@3';
  import { createGrid, createStat } 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/vue.esm.min.js';

  const LatticeGrid = createLatticeGrid({ vue: Vue, createGrid });

  Vue.createApp({
    components: { LatticeGrid },
    data() {
      return {
        line: {
          rowKey: 'id',
          toolPanel: { side: 'left', panels: ['filters', 'columns'] },
          columns: [
            { field: 'line', title: 'Line', filter: { type: 'set' } },
            // The spec is the tolerance; the Cpk tile reads it.
            { field: 'bore', title: 'Bore', type: 'millimetres', spec: { lower: 19.96, upper: 20.04, target: 20 } },
            { field: 'temp', title: 'Coolant', type: 'celsius' },
            { field: 'cycle', title: 'Cycle', type: 'seconds' },
          ],
          rows,  // measured parts
        },
        // The derived shapes read the line's live instance, so they wait for mounted().
        profile: null,
        outOfTolerance: null,
      };
    },
    mounted() {
      const line = this.$refs.line.grid();

      // profile transposes: one row per column, with count, mean, sd, min, max and
      // outliers as the columns. Every other derived shape emits one row per group.
      this.profile = {
        autoHeight: true,
        source: { mode: 'derived', from: line, profile: ['bore', 'temp', 'cycle'], refresh: 'live' },
        columns: [
          { field: 'column', title: 'Measure' }, { field: 'rows', title: 'n', type: 'number' },
          { field: 'mean', title: 'Mean', type: 'number', format: { maximumFractionDigits: 3 } },
          { field: 'stddev', title: 'σ', type: 'number', format: { maximumFractionDigits: 4 } },
          { field: 'outliers', title: 'Outliers', type: 'number' },
        ],
      };

      // where with no groupBy passes real rows through: the parts outside tolerance.
      this.outOfTolerance = {
        autoHeight: true,
        source: { mode: 'derived', from: line, follow: 'filtered', refresh: 'live', where: (r) => Math.abs(r.bore - 20) > 0.04 },
        columns: [{ field: 'id', title: 'Part' }, { field: 'line', title: 'Line' }, { field: 'bore', title: 'Bore', type: 'millimetres' }],
      };

      // Cpk against the column's declared spec, read through a value function.
      const tile = document.getElementById('tiles').appendChild(document.createElement('div'));
      createStat({ grid: line, container: tile, title: 'Cpk',
        value: (g) => g.statistics.capability('bore')?.cpk, goodWhen: 'up', baseline: 1.33, decimals: 2 });
    },
    template: `
      <div>
        <div id="tiles"></div>
        <div id="batch"><lattice-grid ref="line" v-bind="line" /></div>
        <div id="profile"><lattice-grid v-if="profile" v-bind="profile" /></div>
        <div id="oot"><lattice-grid v-if="outOfTolerance" v-bind="outOfTolerance" /></div>
      </div>
    `,
  }).mount('#app');
</script>