Skip to main content
All docs
V24.1

How to Add Error Bars to a Chart Series

The example shows how to add error bars for a chart series.

Follow the steps below to create an error bar:

  1. Call the Add method to create an error bar for a chart series.

  2. Specify the properties of the created ErrorBarsOptions object.

The code sample below creates error bars for a line chart:

chart with error bars

using DevExpress.Spreadsheet.Charts;
//... 
spreadsheetControl1.LoadDocument("Document.xlsx");

var chart1 = spreadsheetControl1.ActiveWorksheet.Charts[0];
ErrorBarsOptions errorBar = chart1.Series[0].ErrorBars.Add(ErrorBarType.Both);
//Specify the error type and value
errorBar.ValueType = ErrorBarValueType.Percentage;
errorBar.Value = 10;
//Specify error bar settings
errorBar.NoEndCap = true;