Lattice Grid Buy a licence

demo D179

Statistics in the totals row in React

Median, percentiles, deviation and spread, each over the filtered rows

total: 'median' · 'p95' · 'stddev'

This grid puts statistics in the totals row, median, percentiles, standard deviation and spread, each computed over the filtered rows. It gives a footer that summarises the shape of a column, not just its sum, and follows the filter as it changes.

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.latticegrid.dev/lattice-grid@1.108.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.latticegrid.dev/lattice-grid@1.108.0/lattice-grid.esm.min.js';
  import createLatticeGrid from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/modules/react.esm.min.js';

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

  const columns = [
    { field: 'reference', title: 'Reference', layout: { pin: 'start', width: 150 } },
    { field: 'desk', title: 'Desk', filter: { type: 'set' } },
    // Each column names its own reduction: median, 95th percentile, deviation.
    { field: 'price', title: 'Price', type: 'number', total: 'median' },
    { field: 'bid', title: 'Bid', type: 'number', total: 'p95' },
    { field: 'volume', title: 'Volume', type: 'number', total: 'iqr' },
    { field: 'notional', title: 'Notional', type: 'number', total: 'sum' },
  ];

  const rows = [/* trading book records */];

  function App() {
    return (
      <LatticeGrid
        rowKey="id"
        columnDefaults={{ filter: true }}
        columns={columns}
        rows={rows}
        style={{ height: '460px' }}
      />
    );
  }

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