Lattice Grid Buy a licence

demo D179

Statistics in the totals row in Svelte

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 Svelte version. A use action attaches the grid to a plain element, so no framework runtime is passed in and the component stays small, while the configuration is ordinary Svelte state.

The configuration

<script>
  import { createGrid } from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/lattice-grid.esm.min.js';
  import createLatticeAction from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/modules/svelte.esm.min.js';

  const lattice = createLatticeAction({ createGrid });

  const config = {
    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>

<svelte:head>
  <link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.108.0/lattice-grid.min.css">
</svelte:head>

<div use:lattice={config} style="height: 460px"></div>