Lattice Grid Buy a licence

demo D179

Statistics in the totals row: JavaScript Data Grid Demo

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…

The configuration

<link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.103.2/lattice-grid.min.css">
<script src="https://cdn.latticegrid.dev/lattice-grid@1.103.2/lattice-grid.min.js"></script>

<div id="grid" style="height: 460px"></div>

<script>
  const grid = LatticeGrid.createGrid(document.getElementById('grid'), {
    rowKey: 'id',
    columnDefaults: { filter: true },
    columns: [
      { field: 'symbol', title: 'Symbol', layout: { pin: 'start', width: 120 } },
      { field: 'desk', title: 'Desk', filter: { type: 'set' } },
      // The reduction is named per column and the title says which one, so the
      // footer reads as what it is. Each figure is over the filtered rows, so
      // filtering a desk moves every one of them.
      { field: 'price', title: 'Price / median', type: 'number', format: { decimals: 4 }, total: 'median' },
      { field: 'bid', title: 'Bid / p95', type: 'number', format: { decimals: 4 }, total: 'p95' },
      { field: 'change', title: 'Change / stddev', type: 'number', format: { style: 'percent', decimals: 2 }, total: 'stddev' },
      { field: 'volume', title: 'Volume / IQR', type: 'number', format: { notation: 'compact' }, total: 'iqr' },
      { field: 'notional', title: 'Notional / sum', type: 'number',
        format: { style: 'currency', currency: 'USD', decimals: 2 }, total: 'sum' },
    ],
    rows,  // trading book: symbol, desk, price, bid, change, volume, notional
  });
</script>