Box plots
A box plot shows how values spread, not just their average: where the middle half lies, how far the rest reaches, and which values stand out. Order values per weekday, response times per endpoint, temperatures per unit.
From raw values
Give BoxPlotSeries one item per value: items with the same XValue form a box. The box runs from the
lower to the upper quartile with the median as a line; the whiskers reach the furthest values within 1.5 box lengths, and values
beyond them are dots. Two series sit side by side, like grouped bars. Hover a box for its numbers; with
Selection="ChartSelectionMode.Points", clicking a box selects all its orders.
Click a box to select its orders.
Code
<RioChart TItem="OrderValue" Selection="ChartSelectionMode.Points" @bind-SelectedItems="selected">
<BoxPlotSeries Name="Web" Items="web" XValue="o => o.Day" YValue="o => o.Value" Format="#,0 €" />
<BoxPlotSeries Name="App" Items="app" XValue="o => o.Day" YValue="o => o.Value" Format="#,0 €" />
</RioChart>
@code {
record OrderValue(string Day, string Channel, double Value); // one row per order
}From numbers computed elsewhere
When a database or monitoring tool already gives the percentiles, pass one item per box with Q1Value,
MedianValue and Q3Value, and the whisker ends with LowValue and HighValue
(here the 5th and 95th percentiles). OutliersValue and CountValue are optional.
Code
<RioChart TItem="Percentiles" Items="responseTimes">
<BoxPlotSeries Name="Response time" XValue="p => p.Endpoint"
LowValue="p => p.P5" Q1Value="p => p.P25" MedianValue="p => p.P50"
Q3Value="p => p.P75" HighValue="p => p.P95" Format="0 'ms'" />
</RioChart>Lying down
With Horizontal="true" on the chart, the boxes run left to right with the categories down the side, first on top:
room for long names such as endpoint paths. YAxis still sets the value axis (title, format, min and max).
Code
<RioChart TItem="Percentiles" Items="responseTimes" Horizontal="true">
<BoxPlotSeries Name="Response time" XValue="p => p.Endpoint"
LowValue="p => p.P5" Q1Value="p => p.P25" MedianValue="p => p.P50"
Q3Value="p => p.P75" HighValue="p => p.P95" Format="0 'ms'" />
</RioChart>In JSON definitions
"type": "boxPlot" (also "box") with x and y computes the boxes from the rows' y values
per x. With q1 and q3 (and low, high), each row is a box and y its median.
"horizontal": true lays the boxes down. Automatic chart types never pick a box plot.