Components
Chart
Composable time-series plot with columns, lines, areas, markers, ranges, thresholds and tooltips.
import { Chart } from "@openperf/deft";
const series = [
{ key: "a", label: "Series A", fill: "fill-chart-neutral", swatch: "bg-chart-neutral" },
{ key: "b", label: "Series B", fill: "fill-chart-bar", swatch: "bg-chart-bar" },
{ key: "c", label: "Series C", fill: "fill-chart-warning", swatch: "bg-chart-warning" },
];
const legend = series.map((item) => ({ className: item.swatch, key: item.key, label: item.label }));
<>
<Chart.Legend items={legend} />
<Chart.Root
aria-label="Requests"
data={data}
formatTime={formatTime}
keys={series.map((item) => item.key)}
stacked
>
<Chart.Columns series={series.map((item) => ({ className: item.fill, key: item.key }))} />
<Chart.Tooltip formatTime={formatTime} series={legend} />
</Chart.Root>
</>;When to use
| Need | Component |
|---|---|
| Time-series with axes, tooltip, markers or comparison | Chart |
| Compact trend shape inside a card or table row (no axes) | Sparkline |
| Single proportion, breakdown or percentile spread | Meter |
| Overlapping spans on one timeline | Waterfall |
Anatomy
<Chart.Legend /> {/* standalone — reads no chart context */}
<Chart.Skeleton /> {/* drop-in placeholder matching height */}
<Chart.Root> {/* layers paint in JSX order */}
<Chart.Threshold />
<Chart.Area /> {/* or Chart.StackedArea / Chart.Columns */}
<Chart.Line />
<Chart.Marker />
<Chart.Range />
<Chart.Tooltip /> {/* keep last so it sits on top */}
</Chart.Root>Buckets are spaced evenly by index in data; time must be unique and ascending. Number formatting uses the active Lingui locale.
Layers & Examples
Lines
tail repaints the trailing fraction (0–1) in the accent color; dot on tooltip series entries highlights the hovered point.
Period comparison
Pair Chart.Area and Chart.Line for the current period with tone="previous" for the dashed baseline.
Stacked area
Set stacked on Chart.Root so the y scale covers the cumulative total. Series render bottom-to-top.
Grouped columns
Without stacked, Chart.Columns places series side by side per bucket. Use partial to fade an in-progress final bucket, or getClassName to highlight a selected one.
Markers
Add top padding on Chart.Root when markers have labels so they don't clip above the plot.
Ranges
Draws a span bar below the plot with a hover tooltip. Omit to to extend through the last bucket.
Thresholds
Fix yDomain when threshold values can exceed the data maximum so the reference line stays inside the plot.
Loading
Match Chart.Skeleton height to Chart.Root to avoid layout shift.
API
Chart.Root
Pass aria-label to name the chart. Chart.Tooltip supports keyboard navigation (Tab, arrows, Home/End, Enter/Space).
Prop
Type
Chart.Line
Prop
Type
Chart.Area
Prop
Type
Chart.Columns
Prop
Type
Chart.StackedArea
Prop
Type
Chart.Marker
Prop
Type
Chart.Range
Prop
Type
Chart.Threshold
Prop
Type
Chart.Tooltip
Prop
Type
Chart.Legend & Chart.Skeleton
Prop
Type