Skip to main content
A newer version of this page is available. .
All docs
V21.1
.NET Framework 4.5.2+

ErrorBarsCollection Interface

A collection of error bars for the series.

Namespace: DevExpress.Spreadsheet.Charts

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

Declaration

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

Remarks

Note

The ErrorBarsCollection has no effect on the visual appearance of a chart when the document is loaded in the SpreadsheetControl. However, the property can be accessed in code, exported in supported formats and visualized in Microsoft Excel.

Call the Add method to create an error bar for a chart series. The created ErrorBarsOptions object allows you to specify the error bar type and value.

Example

The code sample below creates error bars for a line chart (the result is opened in Microsoft Excel):

chart with error bars

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);
    errorBar.NoEndCap = true;

    // Specify the error type and value
    errorBar.ValueType = ErrorBarValueType.Percentage;
    errorBar.Value = 10;
    workbook.SaveDocument("..\\..\\Result.xlsx");
}
See Also