Skip to main content

Box plot chart

info

Charts are available with Avalonia Pro.

A box plot (or box-and-whisker plot) provides a graphical summary of the distribution, central tendency, and variability of data, including quartiles and outliers.

Box plot chart with box-and-whisker symbols per category showing median, quartiles, and outlier data points.

When to use

  • Statistical analysis: Comparing the distribution of several datasets (e.g., test scores across different classes).
  • Outlier detection: Identifying extreme data points that fall outside the "whiskers."
  • Range visualization: Showing the minimum, maximum, median, and interquartile range at a glance.

Code example

XAML

<charts:CartesianChart Name="BoxPlotSample" Title="Box Plot (Box and Whisker)" Height="250">
<charts:CartesianChart.HorizontalAxis>
<charts:CategoryAxis />
</charts:CartesianChart.HorizontalAxis>
<charts:CartesianChart.VerticalAxis>
<charts:NumericalAxis />
</charts:CartesianChart.VerticalAxis>
<charts:CartesianChart.Series>
<charts:BoxPlotSeries Title="Distribution"
ItemsSource="{Binding BoxPlotData}"
CategoryPath="Category"
MinPath="Min" Q1Path="Q1" MedianPath="Median" Q3Path="Q3" MaxPath="Max"
Fill="#7E9C27B0" />
</charts:CartesianChart.Series>
</charts:CartesianChart>

Data model (C#)

public record BoxPlotPoint(string Category, double Min, double Q1, double Median, double Q3, double Max);

public ObservableCollection<BoxPlotPoint> BoxPlotData { get; } = new()
{
new("Q1", 10, 25, 35, 45, 60),
new("Q2", 15, 30, 42, 55, 70),
new("Q3", 20, 35, 48, 60, 75),
new("Q4", 25, 40, 52, 65, 80)
};

Common properties

PropertyDescriptionDefault
ItemsSourceThe collection of statistical data points.null
MinPathPath to the minimum value.null
MaxPathPath to the maximum value.null
MedianPathPath to the median value.null
Q1PathPath to the first quartile (25th percentile).null
Q3PathPath to the third quartile (75th percentile).null
BoxWidthWidth of the box as a fraction of the category slot.0.6
MedianStrokeBrush used for the median line inside the box.null
WhiskerThicknessThickness of the whisker lines.1.0
FillBrush used for the "box."Theme-dependent
StrokeColor of the whiskers and box outline.Theme-dependent