Bar chart
Amounts compared by length: a total per row, named things side by side, parts of a whole, a spread, a funnel.
import { Bars } from "@arcadia/ui/charts"TSX
Anatomy
- Band
- One to a row, its bar centred in it: a quarter of the band is the gap between neighbours.
- Bar
- At most 48px wide, and square at both ends: a rounded end would take from the value it draws, and the end on the baseline stands the bar on its axis.
- Zero and missing
- A zero keeps a 1px sliver on the baseline, so the row reads as measured; a missing value draws nothing.
- Groups
- Up to three series side by side in each band, 2px apart, in the legend's order.
- Stacks
- Parts of a whole on one bar, the largest at the base; only the stack's far end is rounded.
- Signed
- One colour above and below the solid zero rule, which stays visible between the two signs; under zero a bar's rounded end points down.
- Value labels
- Caption in
--text-2, beyond each bar's far end and never inside it: text on a series colour does not hold 4.5:1 in both themes. - Horizontal
- Names at the inline start, end-aligned and fading at their end when long; each bar runs to the inline end with its value beyond it, and the plot draws no grid.
Examples
Reading
- Tab
- Moves to the plot: the reading starts on the newest row (the top one on a horizontal chart), or on the row read last.
- ↑↓
- Step a row as on any slider: Up to the next, or on a horizontal chart to the row above.
- ←→
- Step a row: Right to the next, or on a horizontal chart to the row above.
- HomeEnd
- The first row and the last, or on a horizontal chart the bottom row and the top.
- Esc
- Hides the reading until the next key.
States
Bars
stacked- boolean
- On the other stacked bars, the largest at the base.
horizontal- boolean
- Rows run down the plot, each bar labelled at its end.
labels- boolean
- Each value beyond its bar's end. Always on a horizontal chart.
format- (value: number) => string
- How a value reads on its label and in the reading.
between- readonly (string | null | undefined)[]
- Horizontal: a line between each bar and the next.
labelrequired- string
- The series' name.
valuesrequired- readonly (number | null | undefined)[]
- A value per row of
x;nullis a gap. colorrequired- string
- The paint of the slot its entity owns:
chartColor(1).