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
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/lattice-grid.min.css">
<div id="app"></div>
<script type="module">
import React from 'https://esm.sh/react@18';
import { createRoot } from 'https://esm.sh/react-dom@18/client';
import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/lattice-grid.esm.min.js';
import createLatticeGrid from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/modules/react.esm.min.js';
import { createChart } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/modules/charts.esm.min.js';
const LatticeGrid = createLatticeGrid({ React, createGrid });
const 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' },
];
// e.g. [{ id: 1, task: 'Discovery', phase: 'Plan', start: '2026-01-06', end: '2026-01-14' }, ...]
const rows = [/* one row a task */];
function App() {
const gridRef = React.useRef(null);
React.useEffect(() => {
const grid = gridRef.current.grid;
// Gantt reads a row label and a start and end date; series colours the bars.
createChart({ grid, container: '#chart', type: 'gantt',
label: 'task', start: 'start', end: 'end', series: 'phase', legend: true,
title: 'Schedule by phase' });
}, []);
return (
<>
<div id="chart" style={{ height: '320px' }} />
<LatticeGrid
ref={gridRef}
rowKey="id"
columns={columns}
rows={rows}
style={{ height: '320px', marginTop: '14px' }}
/>
</>
);
}
createRoot(document.getElementById('app')).render(<App />);
</script>