demo D215
Gantt
A row label with a start and an end, coloured by phase
type: 'gantt', label, start, end
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: 'task', title: 'Task', layout: { width: 160 } },
{ field: 'phase', title: 'Phase', filter: { type: 'set' } },
{ field: 'start', title: 'Start', type: 'date' },
{ field: 'end', title: 'End', type: 'date' },
],
rows, // e.g. [{ id: 1, task: 'Discovery', phase: 'Plan', start: '2026-01-06', end: '2026-01-14' }, ...]
// onGrid hands over the live grid the moment it is created. Gantt reads a row
// label and a start and end date; series colours the bars. It follows the grid.
onGrid: (grid) => {
createChart({ grid, container: chartEl, type: 'gantt',
label: 'task', start: 'start', end: 'end', series: 'phase', legend: 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: 320px"></div>
<div use:lattice={config} style="height: 320px; margin-top: 14px"></div>