Skip to content
CHARTS · COMPLETE

BoxPlot

Show how a set of numbers is spread, not just its average.

Show how a set of numbers is spread, not just its average: the middle half, the median and the range.

Why it helps

  • Spread, median and range
  • Outliers visible
  • Several groups

Where it fits

  • Quality control
  • Salaries
  • Test results

Example

<BoxPlot Label="Salary by department" Groups="_groups" ShowMean="true" ColorByGroup="true" ValueFormat="#,0" />

@code {
    private readonly BoxPlotGroup[] _groups = Build();

    private static BoxPlotGroup[] Build()
    {
        var random = new Random(7);
        double[] Sample(double center, double spread, int count) =>
            Enumerable.Range(0, count).Select(_ => center + spread * (random.NextDouble() + random.NextDouble() - 1) * 2).ToArray();

        var engineering = Sample(5200, 900, 40).Concat([9400d, 2100d]).ToArray();
        return
        [
            new("Engineering", engineering),
            new("Design", Sample(4300, 600, 25)),
            new("Sales", Sample(4600, 1200, 35).Concat([9900d]).ToArray()),
            new("Support", Sample(3300, 400, 30))
        ];
    }
}

A short fragment. Add @using RayCraft.Blazor.Components to your page and use an interactive render mode.

Part of RayCraft Complete.

All controls ยท Documentation