Gantt chart with dependencies
Tasks on a calendar, arrows to the tasks that wait for them, milestones, progress and today. Good for project plans where the order of the work matters.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'gantt',
today: 1769990400000,
tasks: [
{ id: 'brief', name: 'Brief', start: 1767571200000, end: 1768521600000, progress: 1 },
{ id: 'design', name: 'Design', start: 1768521600000, end: 1769644800000, progress: 1, after: ['brief'] },
{ id: 'build', name: 'Build', start: 1769644800000, end: 1772064000000, progress: 0.35, after: ['design'] },
{ id: 'content', name: 'Content', start: 1769299200000, end: 1771200000000, progress: 0.6, after: ['brief'] },
{ id: 'test', name: 'Test', start: 1772064000000, end: 1773100800000, progress: 0, after: ['build', 'content'] },
{ id: 'launch', name: 'Launch', start: 1773273600000, after: ['test'] },
],
};
export default function Example() {
return <Chart spec={spec} style={{ height: 340 }} />;
}Or import this chart alone: what each import weighs.
Options
Beside the fields shared by every chart (title, format, heading, export…), type gantt takes:
/** Gantt chart: tasks on a calendar, arrows from a task to the ones waiting for it, milestones and today. */
interface GanttSpec extends Base {
type: 'gantt';
tasks: GanttTask[];
/** A line at this date. */
today?: number | string;
todayLabel?: string;
labelWidth?: number;
formatDate?: (t: number) => string;
onItemClick?: (id: string) => void;
}
interface GanttTask {
id: string;Style it
- Colours:
theme.palette,chart.setColor(name, colour), or--nervure-palettein your CSS. More - Marks:
[data-series="name"], parts:[data-part="axes"],legend,series. What you change is kept in exports. - Movement:
animation: falsedraws at once. More - Files:
chart.download('png'),svg,csv. More