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.

Chart with 2 series. Web: 7 values, lowest 64 € at Mon, highest 70 € at Sun. App: 7 values, lowest 64 € at Thu, highest 83 € at Sun. 0100200300MonTueWedThuFriSatSunOrder value, €WebAppUse Left and Right to move between points, Up and Down to change series. Press Escape to leave.

Click a box to select its orders.

Code
Razor
<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.

Chart with 1 series. Response time: 5 values, lowest 34 ms at /cart, highest 215 ms at /checkout. 0200400600/products/search/cart/checkout/accountmsUse Left and Right to move between points. Press Escape to leave.
Code
Razor
<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).

Chart with 1 series. Response time: 5 values, lowest 34 ms at /cart, highest 215 ms at /checkout. 0100200300400500ms/products/search/cart/checkout/accountUse Left and Right to move between points. Press Escape to leave.
Code
Razor
<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.

An unhandled error has occurred. Reload 🗙