officefileapi-devexpress-dot-spreadsheet-dot-charts-43ff0ab7.md
Contains options for a chart series error bar.
Namespace : DevExpress.Spreadsheet.Charts
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
public interface ErrorBarsOptions :
ShapeFormat,
ShapeFormatBase
Public Interface ErrorBarsOptions
Inherits ShapeFormat,
ShapeFormatBase
The following members return ErrorBarsOptions objects:
Error bars are displayed in the SpreadsheetControl only for the following chart types:
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:
ValueTypeGets or sets the value type of the error bar.ValueGets or sets the error value.
The following properties are in effect only for the custom value type (ErrorBarsOptions.ValueType):
MinusGets or sets the negative error value.PlusGets 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.NoEndCapGets 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.
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");
}
Imports DevExpress.Spreadsheet.Charts
'...
Using workbook = New Workbook()
workbook.LoadDocument("..\..\workbook.xlsx")
Dim worksheet = workbook.Worksheets(0)
' Create a chart and specify its location.
Dim chart As 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.
Dim errorBar As ErrorBarsOptions = 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")
End Using
See Also