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

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

<div id="grid" style="height: 460px"></div>
<pre id="out" style="margin-top: 12px"></pre>

<script>
  const grid = LatticeGrid.createGrid(document.getElementById('grid'), {
    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,
  });

  const out = document.getElementById('out');
  const report = () => {
    // by is required: reductions see rows as loaded, not in the grid's sort.
    out.textContent = JSON.stringify(
      grid.statistics.series('price', { by: 'date', periodsPerYear: 252 }), null, 2);
  };
  grid.on('filter:changed', report);  // every figure follows the filters
  report();
</script>