Skip to main content

Error bar chart

info

Charts are available with Avalonia Pro.

Error bar charts represent the variability of data and are used on graphs to indicate the error or uncertainty in a reported measurement.

Chart with data points and vertical error indicators showing standard deviation ranges for each sample.

When to use

  • Scientific research: Visualizing standard deviation or confidence intervals.
  • Quality control: Showing the range of tolerance in manufacturing.
  • Survey data: Indicating the margin of error in statistical polls.

Code example

XAML

<charts:CartesianChart Name="ErrorBarChartSample" Title="Measurement Uncertainty" Height="250">
<charts:CartesianChart.HorizontalAxis><charts:CategoryAxis /></charts:CartesianChart.HorizontalAxis>
<charts:CartesianChart.VerticalAxis><charts:NumericalAxis /></charts:CartesianChart.VerticalAxis>
<charts:CartesianChart.Series>
<charts:ErrorBarSeries Title="Measurements"
CategoryPath="Sample"
ValuePath="Value"
ErrorPath="Error"
CapWidth="10"
ShowMarkers="True"
MarkerSize="8"
ItemsSource="{Binding ErrorBarData}" />
</charts:CartesianChart.Series>
</charts:CartesianChart>

Data model (C#)

public record ErrorBarItem(string Sample, double Value, double Error);

public ObservableCollection<ErrorBarItem> ErrorBarData { get; } = new()
{
new("A", 45.0, 5.0),
new("B", 62.0, 8.0),
new("C", 38.0, 4.0),
new("D", 75.0, 10.0),
new("E", 55.0, 6.0)
};

Common properties

PropertyDescriptionDefault
ItemsSourceThe collection of measured data.null
ValuePathThe central value (Mean/Median).null
ErrorPathSymmetric error amount applied above and below the value.null
LowErrorPathLower error amount for asymmetric error bars.null
HighErrorPathUpper error amount for asymmetric error bars.null
ErrorModeWhether to draw the error bar above, below, or on both sides of the value.Both
CapWidthThe width of the horizontal caps on the error bars.8
ShowMarkersWhether to draw a marker at each central value.false
MarkerSizeSize of the central marker.8
StrokeColor of the error indicator lines.Theme-dependent