Lattice Grid Buy a licence

demo D281

Flag the readings that do not fit in React

A column that marks the outliers in a series, scored by a robust measure a single spike cannot skew, with a chip that counts them and filters the grid to exactly those rows

shadow: { kind: 'anomalyFlag' } · anomalySummary

This grid marks the outliers in a series with a column scored by a robust measure a single spike cannot skew, and a chip that counts them and filters the grid to exactly those rows. It surfaces the readings that do not fit and takes you straight to them.

Building…
Loading a live grid…

This is the React version. The grid mounts through the createLatticeGrid adapter, which takes its configuration as ordinary props and hands back the live grid through a ref. The grid below is the same one every other tab runs.

The configuration

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.71.0/lattice-grid.min.css">

<div id="grid"></div>

<script type="module">
  import React from 'https://esm.sh/react@18';
  import { createRoot } from 'https://esm.sh/react-dom@18/client';
  import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.71.0/lattice-grid.esm.min.js';
  import createLatticeGrid from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.71.0/modules/react.esm.min.js';

  const LatticeGrid = createLatticeGrid({ React, createGrid });

  const columns = [
    { field: 'day', title: 'Day', type: 'number', layout: { width: 80, pin: 'start' } },
    { field: 'value', title: 'Reading', type: 'number', total: 'median', layout: { flex: 1, min: 120 } },
    // The score is built on the median and MAD, so a single wild reading
    // cannot inflate the spread and hide the others. Signed, so a spike and a
    // dip read apart; the flag marks the ones that sit too far from the rest.
    { id: 'score', title: 'Anomaly score', shadow: { of: 'value', kind: 'anomalyScore' }, type: 'number', format: { decimals: 2, signed: true }, layout: { width: 150 } },
    { id: 'flag', title: 'Anomaly', shadow: { of: 'value', kind: 'anomalyFlag' }, layout: { width: 120 } },
  ];

  const rows = [/* one row a day: day, value */];

  function App() {
    return (
      // The toolbar chip counts the flagged rows; click it to filter to them.
      <LatticeGrid rowKey="id" anomalySummary={{ label: 'Anomalies' }} columns={columns} rows={rows} style={{ height: '440px' }} />
    );
  }

  createRoot(document.getElementById('grid')).render(<App />);
</script>