Skip to content

Gantt chart ​

Bars on a calendar. Good for plans, phases and bookings.

The smallest code that works. change the code, then press Run

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'timeline',
  rows: ['Design', 'Build', 'Test', 'Launch'],
  now: 1777334400000,
  nowLabel: 'Today',
  bars: [
    { row: 'Design', start: 1768348800000, end: 1772755200000 },
    { row: 'Build', start: 1771459200000, end: 1776384000000 },
    { row: 'Test', start: 1774828800000, end: 1778889600000 },
    { row: 'Launch', start: 1778803200000, end: 1783468800000 },
  ],
};

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 timeline takes:

/** Dates are timestamps in milliseconds. */
interface TimelineSpec extends Base, Clickable {
  type: 'timeline';
  rows: string[];
  bars?: TimelineBar[];
  marks?: TimelineMark[];
  now?: number;
  nowLabel?: string;
  labelWidth?: number;
  formatDate?: (t: number) => string;
}

interface TimelineBar {
  row: string;

interface TimelineMark {
  row: string;

Style it

  • Colours: theme.palette, chart.setColor(name, colour), or --nervure-palette in your CSS. More
  • Marks: [data-series="name"], parts: [data-part="axes"], legend, series. What you change is kept in exports.
  • Movement: animation: false draws at once. More
  • Files: chart.download('png'), svg, csv. More

Close to it