ui-kit0.0

Charts

Area chart

Trends with soft gradient areas.

Usage

AreaChart draws a gradient that fades to transparent under each line. Pass the records, the key of the x value (index) and the series to plot. Colours come from CSS variables, so the chart follows theme, dark mode and accent with no re-render.

Area chart of Desktop, Mobile, 90 points from Apr 1 to Jun 29.
dateDesktopMobile
Apr 1320260
Apr 2334268
Apr 3348273
Apr 4361276
Apr 5293307
Apr 6305305
Apr 7395271
Apr 8404265
Apr 9411258
Apr 10417249
Apr 11421239
Apr 12343260
Apr 13343250
Apr 14422211
Apr 15419203
Apr 16414196
Apr 17407191
Apr 18399189
Apr 19310218
Apr 20300220
Apr 21369194
Apr 22358201
Apr 23346210
Apr 24335220
Apr 25323233
Apr 26232276
Apr 27222290
Apr 28293274
Apr 29285287
Apr 30279301
May 1274312
May 2271323
May 3189361
May 4190367
May 5272341
May 6276343
May 7281342
May 8289339
May 9298334
May 10228357
May 11240349
May 12332309
May 13345300
May 14359290
May 15373280
May 16387272
May 17321295
May 18334289
May 19426255
May 20438254
May 21448255
May 22457258
May 23464264
May 24390302
May 25394312
May 26476293
May 27476306
May 28475320
May 29471334
May 30466348
May 31380391
Jun 1372404
Jun 2443385
Jun 3433394
Jun 4422401
Jun 5410406
Jun 6399408
Jun 7307439
Jun 8296436
Jun 9365402
Jun 10355396
Jun 11346388
Jun 12338379
Jun 13332370
Jun 14247390
Jun 15244380
Jun 16322341
Jun 17322333
Jun 18325327
Jun 19329323
Jun 20334320
Jun 21262350
Jun 22271353
Jun 23361327
Jun 24373334
Jun 25385343
Jun 26398354
Jun 27412367
Jun 28346410
Jun 29360424

When to use

  • A trend over time where the volume under the line matters (traffic, revenue, usage).
  • Two or three overlaid series, or a stacked composition of one total.

Not for: exact comparisons between categories (use a bar chart) or many overlapping series (use a line chart).

Stacked

Set stacked to pile the series on top of each other. The tooltip still shows each series on its own, and the top edge is the total.

Stacked area chart of Enterprise, Team, Starter, 6 points from Jan to Jun.
monthEnterpriseTeamStarter
Jan$12,400$7,800$4,200
Feb$13,900$8,100$4,350
Mar$14,200$8,900$4,600
Apr$16,800$9,600$4,550
May$18,100$10,300$4,900
Jun$21,500$11,200$5,100

API

AreaChart

PropTypeDefaultDescription
dataRecord<string, unknown>[]—One record per x position.
indexstring—Key of the x value in each record.
series{ key, label?, color? }[]—Series to plot. color is 'series-1'…'series-6' or any CSS colour.
stackedbooleanfalseStack the series instead of overlaying them.
curve'monotone' | 'linear' | 'step''monotone'Monotone never overshoots the data.
heightnumber280Plot height in px. The width fills the parent.
valueFormat'number' | 'currency' | 'percent' | 'compact' | Intl options | (n) => string'number'Formats tooltip values; axis ticks use a compact form.
indexFormat(value, i) => string—Formats the x value in the axis, tooltip and data table.
xAxis / yAxisboolean | optionstrueyAxis options: format, ticks, width, domain. xAxis options: format.
gridboolean | 'horizontal' | 'vertical' | 'both'trueDashed grid; true means horizontal lines.
legend'top' | 'bottom' | falsebottom when there are 2+ seriesLegend items toggle their series.
tooltipboolean | { labelFormat }trueCrosshair, dots and a readout.
animatebooleantrueDraw-in on mount and smooth transitions between data.

Keyboard

KeyAction
TabFocuses the chart.
← / →Moves the active point; the readout is announced.
Home / EndJumps to the first or last point.
EscClears the active point.

Accessibility

  • The svg is role="img" with a generated summary (override with aria-label).
  • A visually hidden table lists every value, so screen readers can read the data.
  • Touch scrubs horizontally while vertical swipes still scroll the page.
  • Series are told apart by position in the legend and tooltip as well as colour.

Motion

  • On mount the line draws in and the area fades up (600ms, ease-out). Nothing animates during server render.
  • The crosshair and dots glide between points; the tooltip follows the pointer and flips at the edge.
  • Changing data eases the values over 450ms.
  • Reduced motion: no draw-in, no glide; the state still changes.