Lattice Grid Buy a licence

demo D259

Icicle in ESM

A hierarchy as nested bars, each band as wide as the share of the total beneath it

type: 'icicle', y

This draws a hierarchy as nested bars, each band as wide as the share of the total beneath it. It shows how a total breaks down through levels, so where the weight sits in a tree reads as width.

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-icicle';  // opt in to the icicle type

  const grid = createGrid(document.getElementById('grid'), {
    rowKey: 'id',
    columns: [
      { field: 'region', title: 'Region', group: { enabled: true, index: 0 } },
      { field: 'status', title: 'Status', group: { enabled: true, index: 1 } },
      { field: 'charge', title: 'Monthly charge', type: 'number',
        format: { style: 'currency', currency: 'GBP' }, total: 'sum' },
    ],
    // The icicle reads the grid's group tree, so keep the groups folded.
    group: { expanded: false },
    rows,  // circuits: region, status, charge
  });

  createChart({
    grid,
    container: document.getElementById('chart'),
    type: 'icicle',
    y: 'charge',
    title: 'Charge by region, then status',
  });
</script>