Chart
A plot's frame: its rows, scale and height, with a dashed grid, both axes, a legend and a reading by pointer, touch and keys.
import { Chart, Grid, XAxis and 5 more } from "@arcadia/ui/charts"TSX
Anatomy
- Plot
--chart-htall, 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-crosshairon 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-2and 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
Reading
- 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
sm: 128px, usually 3 rulesmd: 192px, usually 4 rules, the defaultlg: 256px, usually 5 rulesNarrow
560px
440px: the top value in place of the axis
300px: the x labels thinned
--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
Cardit is in.
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"
sm128px,md192px,lg256px, 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>.