Skip to content
InsightCharts

Search

Search guides and components

Timeline chart

Places events and spans on a time axis in labelled lanes, with each item named directly.

Use when
When things happened and how long they lasted: project phases, terms of office, product launches, the sequence of events in a story. Mix spans (start and end) with point milestones (start only).
Avoid when
A measured value changing over time (use line chart, with annotations for the events); more than about 40 items (filter, or split into several timelines); durations to be compared precisely with no interest in when (use bar chart).

Preview

The Apollo programme ran from May 1961 to December 1972

NASA human spaceflight programmes and milestones, 1958 to 1981

Source: NASA History Office · Figures are approximate, for illustration

Composition

Used in

1 template uses timeline chart.

Templates

1

A story told in date order. It has a headline, one overview exhibit of the whole period (a timeline chart or an annotated line), dated chapters along a rail, a closing paragraph and a source note. Each chapter has a short text and an optional small exhibit.

Installation

$ pnpm dlx shadcn@latest add @insightcharts/timeline-chart

The CLI copies the source into your project and needs the @insightcharts registry in components.json; see installation. With the package, import it by name:

import { TimelineChart } from "insightcharts";

Examples

Single lane, milestones only

The first approved Covid-19 vaccine dose was given on 8 December 2020

Key dates in the first year of Covid-19, December 2019 to December 2020

Source: WHO, MHRA · Figures are approximate, for illustration

Project plan with lanes

Public launch is planned for 23 September 2025

Product roadmap by team, 2025

Illustrative plan

Stress: long names, crowded lanes, centuries

Victoria reigned from 1837 to 1901

English and British monarchs by royal house, 1558 to 1901

Source: Royal Household · Figures are approximate, for illustration

Props

PropTypeDescription
namerequiredstringLabel field: what the event or span is.
startrequiredstringStart field: ISO date, year or timestamp.
endstringEnd field. Rows without an end are point milestones.
lanestringField that groups rows into labelled lanes.
precision"year" | "month" | "day"Date precision in tooltips. Default: chosen from the span of the data.
Common chart props 29

Every chart built with defineChart accepts these on top of its own props.

PropTypeDescription
dataDataInputRows, CSV text, a URL, { url, path }, an async function, or an Arrow-style table. Omit inside <InsightData>.
transformTransform | Transform[]A pipeline of transforms applied before drawing.
titlestringThe title. One plain statement of what the data shows, with the number and the period ("Monthly churn fell from 4.2% to 2.1% in 2024"), or a plain label ("Monthly churn, 2024"). One clause, no figures of speech.
subtitlestringMeasure, unit, population, period.
sourcestringData source, shown as "Source: ...".
notestringMethod notes or caveats.
heightnumber | stringCSS height of the plot. Default 360.
aspectnumberWidth / height. Overrides height.
highlightstring | string[]The entity (or entities) the title is about. Every other series is drawn in grey.
annotationsAnnotation[]Reference lines, shaded bands and callouts, in data coordinates.
formatFormatSpecHow to print values: "compact", "percent", "currency:USD", "{value} kg", Intl options, or a function.
legendbooleanShow the legend. Default: shown when there are two or more series.
selectboolean | stringMake marks clickable to filter. Inside <InsightData> the selection filters every other chart. Pass a field name, or true to use the chart's category field.
onSelect(values: string[], field: string) => voidCalled with the selected values whenever the selection changes.
optionEChartsOption | ((option: EChartsOption, ctx: BuildContext) => EChartsOption)Deep-merged over the generated ECharts option, or a function that receives and returns it. Use it for ECharts settings no prop covers.
themeThemeInputA theme, or a partial set of tokens merged over the surrounding theme, for this chart only.
modeModeInput"auto" (default) follows the page, "system" follows the OS, or force "light" / "dark".
rendererRendererInput"auto" (default) uses SVG for light charts and canvas for heavy ones.
animatebooleanSet false to disable animation. Reduced-motion preferences are always respected.
lazybooleanMount the chart only when it scrolls near the viewport. Default true.
groupstringLink tooltips with other charts sharing this group id.
exportableboolean | ExportFormat[]Show an export menu: true or a list of formats from png, jpeg, svg, pdf, csv, json.
tablebooleanShow a collapsible "View data" table under the chart.
altstringAccessible description: the chart type and measures, then the main pattern and the notable values.
idstringStable id for this chart's selection in the shared store.
onEventsRecord<string, ChartEventHandler>ECharts event handlers, e.g. { click: (params, chart) => {} }. Prefix a name with zr: to bind to the canvas itself.
onReady(chart: EChartsInstance) => voidCalled with the ECharts instance once it is created.
classNamestringClass name for the outer <figure>.
styleCSSPropertiesInline style for the outer <figure>.