Skip to content

Timeseries Chart

A line (and optional area) chart on TanStack Charts, themed by the chart tokens: grid and tooltip follow light and dark, and the deploy marker is a dashed rule so a before and after read at a glance.

4.5 kB gzipSource Registry JSON

TimeseriesChart playground

Props

color

Installation

npx shadcn@latest add https://sproutboat.com/ikada/r/timeseries-chart.json

The CLI writes components/ikada/timeseries-chart.tsx and merges the ikada theme into your CSS. Or take it from the package: import { TimeseriesChart } from "@sproutboat/ikada/charts";

Usage

import { TimeseriesChart } from "@/components/ikada/timeseries-chart";

const start = Date.UTC(2026, 10, 4);
const data = Array.from({ length: 48 }, (_, i) => ({
  time: start + i * 3_600_000, // one point an hour
  value: 120 + Math.round(60 * Math.sin(i / 6)) + i * 2,
}));

<TimeseriesChart
  ariaLabel="Requests, last 48 hours"
  series={[{ id: "req", label: "Requests", data, area: true }]}
  deploy={{ time: start + 30 * 3_600_000, label: "Deploy" }}
/>

Examples

Requests

Two series

Colour tokens and a dashed line tell series apart without relying on hue alone.

No data

Props

TimeseriesChartProps
PropTypeDescription
seriesrequiredreadonly TimeseriesSeries[]The lines to draw: a label, a colour and the points of each.
deployDeployMarker | readonly DeployMarker[]A dashed vertical rule with a label, in the `chart-deploy` color.
heightnumberHeight in pixels. Default 210; the width fills the container.
yDomainreadonly [number, number][min, max] of the value axis. Defaults to 0 up to the largest value, rounded up.
xDomainreadonly [number, number]Time range in ms [from, to]. Defaults to the span of the data.
formatTime((time: number) => string)Formats x ticks and the tooltip heading. Defaults to clock times ("14:30") for epoch milliseconds spanning up to two days, dates ("Nov 5") beyond that, and plain numbers otherwise.
localestringNumber and date locale; defaults to the `LocaleProvider` value, else `en`.
emptyTextstringShown in place of the plot when no series has a point. Default `No data for this range`.
formatValue((value: number) => string)Formats y ticks and tooltip values. Default `(value: number): string => formatNumber(value)`.
formatTick((value: number) => string)Formats y axis ticks. Defaults to compact numbers (1.5K) with no unit, so labels stay narrow.
xTicksnumberApproximate number of x ticks. Defaults to 5.
yTicksnumberAbout how many value ticks to draw. Default 4.
classNamestringClasses merged onto the root element, after ikada's own.
aria-labelstring—
ariaLabelstring—

Source: src/charts/timeseries-chart.tsx