Draft. Ported from the shadcn-vue Chart (registry style reka-nova, read 12 November 2026). Not yet approved; the API may still change.
Chart is the frame around a chart, not the chart itself. ChartContainer turns a config of series into colour variables, ChartLegendContent names every series, and ChartTooltipContent shows the values at one point. Draw the series with SVG or a chart library inside the container.
When to use
- A value over time: a line chart, such as runs per hour.
- Parts of a stated total: proportional bars, such as jobs by type.
- A trend next to its current value: a sparkline in a KPI tile.
When not to use
- For a few exact numbers people compare or copy. Use a table.
- For one number. Show it as a KPI value with its unit and time range.
- For decoration. No area fills, gradients or pulsing failures (Data visualization).
Colours
Give each series a Beehexa role in the config. Roles follow the light and dark theme, so most configs need no theme entry.
const config = {
completed: { label: 'Completed', color: 'var(--bh-visualization-metric-completed)' },
failed: { label: 'Failed', color: 'var(--bh-visualization-metric-failed)' },
} satisfies ChartConfig
- Named metrics (completed, failed, success rate, queue depth):
visualization.metric.*. - Job types (categories, never statuses):
visualization.job-type.*. - Priority P1 to P5:
visualization.priority.*, always labelled. - There is no general categorical palette yet. A series with no matching role needs one added to the tokens first.
Colour is never the only cue: name every series in the legend or next to the mark, and show the numbers somewhere other than the tooltip.
Tokens
| Part | Tokens |
|---|---|
| Plot height | visualization.chart-height (120 px); sparkline visualization.sparkline-height or .sparkline-compact-height |
| Series line | visualization.line-width (2 px); sparkline visualization.sparkline-width |
| Points | visualization.point-radius, visualization.hover-point-radius when hovered; sparkline end visualization.sparkline-point-radius |
| Grid, ticks, cursor | color.border at visualization.grid-width; the hover cursor color.border.bold |
| Axis labels | font.body.small, color.text.subtle |
| Legend | font.label.small, color.text; mark visualization.legend-mark-size (8 px) |
| Tooltip | color.surface.overlay, radius.overlay, elevation.shadow.overlay, font.body.small; padding space.100 by space.050 |
Related
- Data visualization: which chart for which question, and the colour rules.