Lattice Grid Buy a licence

demo D175

Colour schemes

Built-in palettes, the default colour-blind safe

scheme: 'default' · 'bright' · 'earth' · 'mono'

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 defaultEl, brightEl, earthEl, monoEl;

  const config = {
    rowKey: 'id',
    columns: [
      { field: 'circuit', title: 'Circuit', layout: { width: 180 } },
      { field: 'region', title: 'Region', filter: { type: 'set' } },
      { field: 'status', title: 'Status', filter: { type: 'set' } },
      { field: 'bandwidth', title: 'Bandwidth', type: 'number' },
      { field: 'charge', title: 'Monthly charge', type: 'number',
        format: { style: 'currency', currency: 'GBP' }, total: 'sum' },
    ],
    rows,  // an array of circuit records
    // onGrid hands over the live grid the moment it is created. Every chart is
    // built from it and follows the grid's filters and sort; scheme picks the
    // palette. The default scheme is the colour-blind-safe palette.
    onGrid: (grid) => {
      createChart({ grid, container: defaultEl, type: 'pie', x: 'region', y: 'charge', scheme: 'default' });
      createChart({ grid, container: brightEl,  type: 'pie', x: 'region', y: 'charge', scheme: 'bright' });
      createChart({ grid, container: earthEl,   type: 'pie', x: 'region', y: 'charge', scheme: 'earth' });
      createChart({ grid, container: monoEl,    type: 'pie', x: 'region', y: 'charge', scheme: 'mono' });
    },
  };
</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 style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; height: 210px">
  <div bind:this={defaultEl}></div>
  <div bind:this={brightEl}></div>
  <div bind:this={earthEl}></div>
  <div bind:this={monoEl}></div>
</div>
<div use:lattice={config} style="height: 340px; margin-top: 14px"></div>