Chart
One chart for a dashboard's numbers, drawn from labelled values as an area over time by default.
Usage
Examples
Type
type sets what the chart draws: area, the default, or line with nothing under it; "bars" draws a ranking, shown below.
Curve
curve joins the points with a smooth curve, the default, or with straight lines when sharp.
Label count
labelCount sets how many labels the axis spreads under the chart, the first and the last always among them: 5 by default, here beside 3.
Sparkline
sparkline leaves out the grid and the axis, for a small chart beside a figure, beside a chart with both as it is by default.
Previous
A point's previous value draws the period before as a dashed line behind the current one, and the tooltip lists both.
Value formatter
valueFormatter writes the tooltip's values, here as percentages; by default they are plain numbers.
Colour
color in a series' config paints it in place of the action colour, or of the muted grey for previous: any CSS colour, --chart-1 to --chart-5 first, or a light and a dark one.
Bars
type="bars" draws a ranked list, each value a bar against the largest, with its share of the total in the tooltip.
With icon
A bar's icon sits before its label in the bar and in the tooltip.
Media
A bar's media puts a picture of its own before the label in place of an icon, such as an avatar or a flag.
Loading
loading draws five thin skeleton rows in place of the bars, and loadingIcon puts a square before each when the bars lead with a picture.
Empty
With no rows, bars give way to a NotFound box saying there is nothing yet.
Indicator
indicator on ChartTooltipContent draws each row's mark as a dot, the default, a line, a dashed line or nothing.
Show label
showLabel draws the heading of ChartTooltipContent, naming the point above its rows as it does by default, beside one with showLabel false that leaves it out.
Label formatter
labelFormatter writes ChartTooltipContent's heading, here a whole date, beside one that shows the point's label as it is by default.
Name key
nameKey tells ChartTooltipContent and ChartLegendContent which field of a pie's rows names each slice in the config, beside a legend showing the raw names as it does by default.
Legend
ChartLegend with ChartLegendContent lists the series under the chart, each with its colour and its label from the config.
Show icon
showIcon, on by default, lets a series' icon in the config stand in for its swatch in the legend, as it does for its mark in the tooltip; showIcon false on ChartLegendContent keeps the swatch.