Skip to content
ArcadiaDesign
A month of requests per second. Point at the plot, tap it or use the arrow keys to read a day.

TSX

Chart holds the rows, the value scale and the height, and its children are the parts, each optional: Grid, YAxis and XAxis draw the scale, the marks, Line and Area, draw the values, Legend names the series and Readout reads a row. Leave a part out and its room goes with it.

x lists the rows, oldest first: days as yyyy-mm-dd, timestamps, or names. Every mark gives one value per row, and null is a gap, never a zero. Give each series the paint of the slot its entity owns, chartColor(n), so it keeps its colour on every chart.

label says what the chart counts, and its name starts with it. Say the unit once: in the label, or as unit, a symbol every number carries (ms, %). The value scale starts at zero for areas, and a chart of lines that has a value axis may start on a round value above it.

Anatomy

Plot
--chart-h tall, from the top rule to the baseline. No frame, no background, no axis line and no tick marks: the rules and the labels carry the scale.
Grid
Three to five 1px rules on round values, dashed 4 on 4 in --chart-grid, each fading out over the outer tenth of the plot at both ends.
Zero rule
Solid, in --stroke-2, only where the values cross zero.
Value axis
At the inline start, as wide as its longest label so no number is cut: each label end-aligned and centred on its rule, 16px from the plot.
X axis
A 20px row 16px under the baseline, each label centred under its row; the first and the last line up with the plot's edges.
Labels
Caption in --chart-label, every figure tabular: in full where the rules step by less than 1,000 (1,500), compact from there (2.5K), one precision along the axis (fmtTick).
Legend
A row of toggles above the plot, start-aligned and wrapping: chips 24px tall, each an 8px round swatch and the series' name in Caption and --text-2. Off, the swatch is a ring and the name --text-3.
Crosshair
A solid 1px rule in --chart-crosshair on the read row, from the plot's top to its baseline.
Dots
One on each series at the read row: a core 4px in radius in the series' colour, a 2px ring of --chart-surface, and a flat halo 10px in radius at --chart-wash.
Axis chip
The read row's label in a 20px chip on --bg-elevated, with the float edge and --shadow-sm, centred under the crosshair and held inside the axis at its ends. Labels within 4px of it give way until it moves on.
Readout card
The popup surface with an 8px radius and 10px of padding, 160 to 280px wide, 16px from the crosshair with its top on the plot's top: the row in full in --text-1, bold, a hairline, then a row per shown series, its swatch, its name in --text-2 and its value end-aligned in --text-1, rows 4px apart.
Clearance
16px above the plot and under its baseline, and no side margin, so the chart's edges line up with the text above it. A narrow plot that prints its top value gives it a 16px row of its own and stands 32px under what is above it. A dot's halo may overhang the plot's edge by 10px.

Legend

Legend names the series of a plot that draws several, in the order of the card. A single series has none: the chart's label names it.

Point at an item and the other series sets back; press it to hide its series, and the scale fits the rest.

Each item is a toggle. Pressed, it hides or shows its series and the scale re-fits in the same frame; the rest keep their colours, since a series' colour is its identity. Under the pointer or keyboard focus, an item keeps its series and sets the others back to --chart-dim as a colour change. The legend is one Tab stop: the arrow keys move between its items, Space or Enter presses one.

Reading

Readout turns on one reading for the pointer, a finger and the keys: a crosshair on the read row, a dot on each series, the row on the axis and a card with the values.

The pointer's x picks the nearest row across the plot's whole height, with no delay, and every part is drawn on that row in the pointer's own frame. The card stands at the plot's top, 16px from the crosshair at its inline end, and turns to the start where it would leave the plot. Where neither side holds it, it sits above the plot, and a card taller than the plot keeps its bottom on the baseline. It never covers the row it reads and takes no pointer events.

The card gives the row in full, then a row per shown series in the legend's order, each value in full (11,994, not 12K), a stack's total under a second hairline, and No data where a value is missing. It holds the width of its widest row from its first frame, so it never changes size under a moving pointer. It enters once per reading on the tooltip's step and leaves on its exit; between rows it never glides, and from the keyboard it has no entrance.

On a touch screen a tap or a sideways drag reads, a vertical swipe that starts on the plot scrolls the page, and the reading stays until a tap somewhere else.

Tab
Moves to the plot: the reading starts on the newest row, or on the row read last.
←→
Step a row; right to left, the arrows follow the page.
↑↓
Step a row, as on any slider.
HomeEnd
The first row and the newest.
Esc
Hides the reading until the next key. Leaving the plot clears it.

Sizes

size sets the plot's height and how many rules it usually draws, 64px apart; the width fills the container.

Where a size's rules would leave more than a quarter of the scale empty above the highest value, the grid takes another count from three to five that does not, always on round values.

sm: 128px, usually 3 rules
md: 192px, usually 4 rules, the default
lg: 256px, usually 5 rules

Narrow

A plot answers its container's width and gives up the least first.

Under 480px the value axis makes way for the top rule's value, printed once above the rule's start in a 16px row of its own, unless the scale starts above zero. Then the x labels thin by halves, the first and the last kept, so no two sit closer than 12px. A label is dropped, never turned, cut or shortened. Under 240px a chart is no longer a plot: show the number instead.

560px
440px: the top value in place of the axis
300px: the x labels thinned

rootStyle takes layout and these knobs.

--chart-h
Ref<Space> | DerivedDefault calc(var(--space-16) * 3)
The plot's height, from its top rule to its baseline.
--chart-surface
PaintDefault var(--card-bg, var(--bg-app))
The surface the plot sits on: the page's, or the Card it is in.

A chart is named from its data: what it counts, how many rows, each series' first and last value and the change, and a stack's total. The first specimen is "Requests per second: 30 days, from 206 to 750, up 264%". Without Readout the plot is one image (role="img") with that name, and not a Tab stop.

With Readout the plot is one Tab stop, a horizontal slider (role="slider"): its name the same, its range the rows from 1 to their count, its value the read row, and its value text that row's reading, the row and then each series with its value. On the first specimen's newest row that is "Tue, Oct 6: Requests 750". The value text is the announcement, so the chart has no status region. The focus ring is the kit's, 12px off the plot so it clears the dots' halos, and on a narrow plot it goes around the top value's row as well.

The legend is a group of toggle buttons (aria-pressed), one Tab stop with the arrow keys inside, each at least 24px tall. The axes, the marks and the card are hidden from assistive technology, since the name and the value text say what they show. Colour is never the only key: the legend and the card name every series.

Chart

labelrequired
string
What the chart counts ("Requests per day"): its name starts with it.
xrequired
readonly (string | number | Date)[]
The rows, oldest first: days as yyyy-mm-dd, timestamps, or names.
size
"sm" | "md" | "lg"Default "md"
sm 128px, md 192px, lg 256px, usually with 3, 4 and 5 rules.
unit
string
A symbol every number carries (ms, %).
noun
readonly [one: string, many: string]
What the name calls a row, ["service", "services"]; dates name themselves.
rootStyle
RootStyle<ChartKnobs>

Rest props go to HTMLAttributes<HTMLDivElement>.