Lattice Grid Buy a licence

demo D257

Hexbin in ESM

Bin a dense scatter into hexagons, so a cloud too thick to read becomes a shape you can

type: 'hexbin', x, y

This bins a dense scatter into hexagons, so a cloud of points too thick to read becomes a shape you can. It reveals where points concentrate when a plain scatter is a solid blob, showing density as colour.

Building…
Loading a live grid…

This is the ES module version. The grid is imported straight from a CDN as a module, the same configuration as the vanilla tab without a global script tag, so it drops into any bundler or a bare module script.

The configuration

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

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

<script type="module">
  import { createChart } from '@toclocoinc/lattice-grid/modules/charts';
  import '@toclocoinc/lattice-grid/modules/chart-hexbin';  // opt in to the hexbin type

  const grid = createGrid(document.getElementById('grid'), {
    rowKey: 'id',
    columns: [
      { field: 'symbol', title: 'Symbol' },
      { field: 'desk', title: 'Desk', filter: { type: 'set' } },
      { field: 'price', title: 'Price', type: 'number', format: { decimals: 4 } },
      { field: 'bid', title: 'Bid', type: 'number', format: { decimals: 4 } },
      { field: 'ask', title: 'Ask', type: 'number', format: { decimals: 4 } },
      { field: 'volume', title: 'Volume', type: 'number', format: { notation: 'compact' } },
      { field: 'notional', title: 'Notional', type: 'number',
        format: { style: 'currency', currency: 'USD' }, total: 'sum' },
    ],
    rows,  // instruments: symbol, desk, price, bid, ask, volume, notional
  });

  // A chart reads the grid's filtered rows and redraws when the grid changes.
  // Thousands of points binned into hexagons: the darker the cell, the more
  // points fell in it.
  createChart({
    grid,
    container: document.getElementById('chart'),
    type: 'hexbin',
    x: 'volume',
    y: 'notional',
    title: 'Notional against volume',
  });
</script>