Histogram
A histogram shows how values are distributed: how many requests took 100 to 110 ms, how many 110 to 120. The values are counted in bins of equal width, drawn as bars that touch.
Response times
Give HistogramSeries one item per value, with the value as XValue. The bins get round edges: a width
of 1, 2 or 5 times a power of ten, picked from the data when BinWidth and BinCount are not set.
BinCount asks for about that many bins. The tooltip shows each bin's range and count, and a click gives the
bin's items.
Code
<RioChart TItem="Request" Items="requests" XAxis="ms" YAxis="requests">
<HistogramSeries Name="Requests" XValue="r => r.Ms" />
</RioChart>
@code {
record Request(double Ms);
AxisOptions ms = new() { Title = "ms" };
AxisOptions requests = new() { Title = "Requests" };
}Before and after
Several histograms on one chart overlay, see-through, so the shapes can be compared. Give them the same
BinWidth: each one picks its own width from its data otherwise, and the bins would not line up.
Code
<RioChart TItem="Request" XAxis="ms" YAxis="requests">
<HistogramSeries Name="Before" Items="before" XValue="r => r.Ms" BinWidth="10" />
<HistogramSeries Name="After" Items="after" XValue="r => r.Ms" BinWidth="10" />
</RioChart>In JSON definitions
"type": "histogram" with the numeric field to count as x (no y: the count is the value), and
"binWidth" or "binCount" if wanted. With groupBy, every group gets the same bins.