Skip to main content
All docs
V24.1

ErrorBarsCollection Interface

A collection of error bars for the series.

Namespace: DevExpress.Spreadsheet.Charts

Assembly: DevExpress.Spreadsheet.v24.1.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

public interface ErrorBarsCollection :
    ISimpleCollection<ErrorBarsOptions>,
    IEnumerable<ErrorBarsOptions>,
    IEnumerable,
    ICollection

The following members return ErrorBarsCollection objects:

Remarks

Error bars are displayed in the SpreadsheetControl only for the following chart types:

  • Column Clustered
  • Bar Clustered
  • Area
  • Line
  • Line with Markers
  • Stacked Line with Markers
  • 100% Stacked Line with Markers
  • Scatter
  • Scatter with Smooth Lines and Markers
  • Scatter with Smooth Lines
  • Scatter with Straight Lines and Markers
  • Scatter with Straight Lines

For other chart types, error bars can be accessed in code, exported in supported formats, and visualized in Microsoft Excel.

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 following error bar settings are available:

ValueType
Gets or sets the value type of the error bar.
Value
Gets or sets the error value.

The following properties are in effect only for the custom value type (ErrorBarsOptions.ValueType):

Minus
Gets or sets the negative error value.
Plus
Gets or sets the positive error value.

The following properties allow you to customize the error bar’s appearance:

Outline
Specifies the bar width and dash style.
Fill
Specifies the bar color.
NoEndCap
Gets or sets whether the error bar has an end cap.

Note

Bars always run parallel to the Y axis (regardless of its orientation). The ErrorBarsOptions.BarDirection property has no effect.

Error bars direction

Example

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

chart with error bars

using DevExpress.Spreadsheet.Charts;
//... 
using (var workbook = new Workbook()) 
{
    workbook.LoadDocument("..\\..\\workbook.xlsx");
    var worksheet = workbook.Worksheets[0];

    // Create a chart and specify its location.
    Chart chart = worksheet.Charts.Add(ChartType.LineMarker,worksheet["A1:B13"]);
    chart.TopLeftCell = worksheet.Cells["E2"];
    chart.BottomRightCell = worksheet.Cells["K14"];
    chart.Legend.Visible = false;

    // Create an error bar.
    ErrorBarsOptions errorBar = chart.Series[0].ErrorBars.Add(ErrorBarType.Both);
    // Specify the error bar settings.
    errorBar.ValueType = ErrorBarValueType.Percentage;
    errorBar.Value = 10;
    errorBar.NoEndCap = true;

    workbook.SaveDocument("..\\..\\Result.xlsx");
}
See Also