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
Related API Members
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:
Call the Add method to create an error bar for a chart series.
Specify the properties of the created ErrorBarsOptions object.
The following error bar settings are available:
The following properties are in effect only for the custom
value type (ErrorBarsOptions.ValueType
):
The following properties allow you to customize the error bar’s appearance:
- 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.
Example
The code sample below creates error bars for a line chart:
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");
}