Bullet charts
A bullet chart shows a value against its target in a single row: a bar for the value, a mark for the target, and tinted ranges for poor, fair and good. Several fit where one gauge would, so they suit dashboards and KPI lists.
Measures with their own scales
Each BulletSeries is a row with its own scale from Min (default 0) to Max, with tick
labels under it, so measures in different units can share a chart. Give it a Value, a Target and
ColorBands: the bands are tinted behind the bar, and the bar takes the color of the band its value is in. Rows are
labeled by their Name; there is no legend.
Code
<RioChart TItem="object" Title="March">
<BulletSeries Name="Revenue" Value="268" Max="300" Target="250" Format="0 k€" ColorBands="revenue" />
<BulletSeries Name="Margin" Value="22" Max="40" Target="26" Format="0'%'" />
<BulletSeries Name="Rating" Value="4.4" Min="1" Max="5" Target="4.2" Format="0.0" />
</RioChart>
@code {
ColorBand[] revenue =
[
new() { Below = 150, Color = "--rio-negative" },
new() { Above = 225, Color = "--rio-positive" },
];
}A row per item
With Items, XValue labels each row and YValue is its value; TargetValue gives
each item its own target. The rows share the series' scale. With Aggregate, items with the same x make one row,
and their targets are combined the same way. DataLabels writes the value after the bar.
Code
<RioChart TItem="Region" Items="regions" Title="Sales against target">
<BulletSeries XValue="r => r.Name" YValue="r => r.Sales" TargetValue="r => r.Target" Format="0 k€" DataLabels="true" />
</RioChart>
@code {
record Region(string Name, double Sales, double Target);
}In JSON definitions
"type": "bullet" with x (the rows), y, and a "targetField" with each row's
target, or one "target" for all; "min", "max" and "colorBands" as for gauges.
Without x a bullet shows one value from the rows (the last, or the aggregate).
{ "dataset": "sales", "series": [ { "type": "bullet", "x": "region", "y": "amount", "targetField": "goal", "aggregate": "sum" } ] }