ui-kit0.0

Charts

Line chart

Several series over time.

Usage

LineChart compares a few series over an ordered x axis. Click a legend item to hide a series; the last visible one cannot be hidden.

Line chart of Revenue, Expenses, 12 points from Jan to Dec.
monthRevenueExpenses
Jan$18,400$12,100
Feb$20,250$12,900
Mar$19,600$14,300
Apr$23,100$13,800
May$25,800$15,200
Jun$24,900$16,700
Jul$28,300$16,100
Aug$30,100$17,400
Sep$29,400$18,900
Oct$32,800$18,200
Nov$35,600$19,800
Dec$38,900$21,300

When to use

  • Comparing several series over time without the weight of filled areas.
  • Values where the exact path matters (latency, price, temperature).

Not for: parts of a whole (use a donut) or comparing unordered categories (use bars).

Curves

monotone (default) smooths the line without ever drawing a peak higher than the data. linear joins points with straight segments and step holds each value until the next.

Line chart of p50 latency, p95 latency, 8 points from 00:00 to 21:00.
hourp50 latencyp95 latency
00:00112ms240ms
03:00104ms218ms
06:00118ms262ms
09:00146ms388ms
12:00171ms452ms
15:00158ms410ms
18:00139ms331ms
21:00121ms275ms

API

LineChart

PropTypeDefaultDescription
dataRecord<string, unknown>[]—One record per x position. Missing values leave a gap in the line.
indexstring—Key of the x value in each record.
series{ key, label?, color? }[]—color is 'series-1'…'series-6' or any CSS colour.
curve'monotone' | 'linear' | 'step''monotone'Line interpolation.
heightnumber280Plot height in px.
valueFormat'number' | 'currency' | 'percent' | 'compact' | Intl options | (n) => string'number''percent' expects 0–100 values; pass { style: 'percent' } for fractions.
indexFormat(value, i) => string—Formats the x value everywhere.
xAxis / yAxisboolean | optionstrueyAxis options: format, ticks, width, domain: [min, max].
gridboolean | 'horizontal' | 'vertical' | 'both'trueDashed grid lines.
legend'top' | 'bottom' | falsebottom when there are 2+ seriesClicking an item toggles its series.
tooltipboolean | { labelFormat }trueSnaps to the nearest point.
animatebooleantrueDraw-in and data transitions.

Keyboard

KeyAction
TabFocuses the chart (then the legend buttons).
← / →Moves the active point.
Home / EndFirst or last point.
EscClears the active point.
Enter / SpaceOn a legend item: hides or shows the series.

Accessibility

  • role="img" with an aria-label summary, plus a visually hidden table of every value.
  • Legend items are toggle buttons (aria-pressed).
  • The tooltip is a visual aid; keyboard users hear the same text through a polite live region.

Motion

  • Lines draw in over 600ms with ease-out, staggered by 40ms per series.
  • The crosshair glides in 160ms; the tooltip in 120ms.
  • Reduced motion removes the draw-in and glide.