Lattice Grid Buy a licence

demo D173

Brushing a time range

Drag a range on the chart and the grid narrows to it

brush: true

Building…
Loading a live grid…

The configuration

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

  const lattice = createLatticeAction({ createGrid });

  let chartEl;

  const config = {
    rowKey: 'id',
    columns: [
      { field: 'date', title: 'Date', type: 'date', layout: { width: 150 } },
      { field: 'price', title: 'Price', type: 'number' },
    ],
    rows,  // an array of daily price records
    // onGrid hands over the live grid the moment it is created. brush lets you
    // drag a range on the chart to narrow the grid to it, and the chart follows
    // the grid's filters and sort from then on.
    onGrid: (grid) => {
      createChart({ grid, container: chartEl, type: 'line', x: 'date', y: 'price', brush: true });
    },
  };
</script>

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

<div bind:this={chartEl} style="height: 300px"></div>
<div use:lattice={config} style="height: 340px; margin-top: 14px"></div>