Bar chart
Compares amounts per period or category as bars from zero, stacked into their total.
Preview
Local preview. It doesn't affect real accounts, environments, or run data.
Compare the same example at each size and density. Switching keeps input values and selection state. Size guidance and comparisons
Six sample days. Workspace rises from 12 to 27 runs. Inventory has no measurement on October 3, so the chart leaves a gap there.
Pipeline run count (runs)
Reporting day
Focus the chart and use Left/Right to inspect points. Escape clears details. The data table includes every series.
View data table
All series are visible.
Usage
Compare amounts per period or category as bars, such as runs per day, tokens per day by kind or an allocation against its targets. A bar's length is its amount, so bars always start at zero on a linear axis. Always provide a title, a factual summary, and axis names with units. Series default to brand and neutral fills, told apart by fill patterns; pass palette="categorical" when color must separate categories, such as kinds or buckets, or palette="extended" for a chart with more series than twelve. stacked adds the series into one bar per row, whose top is their total and which the readout names. A plan, such as a target, is a level to reach: an unfilled dashed bar beside its series, outside the stack and its total. With xScale="time", rows sit by data[].time, each bar centered on its own. references draw thresholds and target bands, and mark events and periods on the x axis. In a dashboard card, density="compact" keeps the plot, legend and floating values; minimal leaves the marks alone. Pass data as an immutable array that the caller owns.
- Don't draw a long or finely sampled series as bars, such as a day every ten minutes: past a few dozen rows the bars thin out to lines. Use LineChart.
- Don't expect bars for values far from zero or orders of magnitude apart: a bar starts at zero, and a log axis has none. Use LineChart, with includeZero={false} or yScale="log".
- Don't stack series that don't add up, such as latency per region. Stack only parts of a total, and set the others side by side.
- Don't mix units on one axis. Use separate charts instead.
- Don't replace missing values with 0. Pass null instead: the chart treats null, undefined, NaN, and Infinity as missing and leaves the bar out, while a 0 is a bar of no length.
- Don't rank named values as bars here. Use BarList, which sorts them with their names and values as text.
- Don't expect the chart to show loading, error, or retry states. Build them in the product screen.
- Don't expect the description prop to be an automatically inferred analysis. It holds the caller's factual summary.
Size: SizeProvider size="small" resizes the whole composition, including portals. The default size is Default. Size guidance and comparisons
Anatomy
figure → figcaption(title + summary) + legend toggle buttons + named axes + responsive Recharts ComposedChart + persistent inline value readout + details → Table.Container → full data table
Keyboard and accessibility
- Tab reaches the legend buttons, the chart, and the data table toggle.
- With the chart focused, Left and Right move between data points.
- Enter or Space on a legend button shows or hides its series, and aria-pressed reports whether it's shown. Hidden series stay in the data table.
- View data table is a native details element that Enter or Space expands. Long tables scroll on both axes. Each series header names the unit once, and the cells hold full values aligned at the end.
- Escape clears the details, and an arrow key shows them again.
- Pointer, touch and the arrow keys show the point's values in a box beside it, which turns to whichever side has more room and stays inside the plot. The same values fill the details region below the plot, a polite live region that never covers the marks; the box itself stays out of the accessibility tree.
- Fill patterns tell the bars apart beyond color, and the legend draws the same ones. They remain in high contrast mode.
- Animation is off by default.
- While the chart's room keeps changing, as while a sidebar slides or a window edge is dragged, the plot holds the width it was drawn at, clipped to the chart, and redraws once the room settles. A single change of room draws at once.
- Test real assistive technology usability separately after product integration.
Give each control a name that describes its purpose. Connect error messages to their controls, and signal state with more than color. Automated checks don't replace manual keyboard and assistive technology testing.
Example code
Shared components take their styles from design tokens. Each example sets its own composition and accessibility attributes. The calling screen defines callbacks, refs, and product data.
Key API
The table lists the common wrapper's main props. See the package type declarations for the full types.