Lattice Grid Buy a licence

demo D194

Variation along an ordering

Volatility, growth and drawdown, from rows loaded out of order

grid.statistics.series(col, { by })

Building…
Loading a live grid…

The configuration

<script>
  import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/lattice-grid.esm.min.js';
  import createLatticeAction from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/modules/svelte.esm.min.js';

  const lattice = createLatticeAction({ createGrid });

  let out = '';

  const config = {
    rowKey: 'id',
    toolPanel: { side: 'left', panels: ['filters', 'columns'] },
    columns: [
      { field: 'date', title: 'Date', type: 'date', layout: { pin: 'start', width: 150 } },
      { field: 'price', title: 'Price', type: 'number' },
    ],
    rows,
    // onGrid hands over the live grid the moment it is created. by is required:
    // reductions see rows as loaded, not in the grid's sort. Every figure follows
    // the filters, so narrow the rows and the series moves.
    onGrid: (grid) => {
      const report = () => {
        out = JSON.stringify(
          grid.statistics.series('price', { by: 'date', periodsPerYear: 252 }), null, 2);
      };
      grid.on('filter:changed', report);
      report();
    },
  };
</script>

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

<div use:lattice={config} style="height: 460px"></div>
<pre style="margin-top: 12px">{out}</pre>