How to display errorbars in WinForms Chart?
Error bars are used to represent the variability of data in WinForms charts, showing the upper and lower bounds of the data points. In this guide, we will explain how to enable error bars, customize their appearance, and specify different symbols for various series in Syncfusion® WinForms Charts.
Error bars can be displayed by setting the DrawErrorBars property to true. You can also customize the shape of the error bar's symbol using the ErrorBarsSymbolShape property. Currently, error bars can be applied only to line charts, where the symbol signifies the top and bottom errors of the chart. Moreover, you can specify separate symbols to represent different series.
//Assign the X and Y axes
this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.Double;
this.chartControl1.PrimaryYAxis.ValueType = ChartValueType.Double;
// Configure the chart series
ChartSeries series = new ChartSeries("Series", ChartSeriesType.Line);
series.Points.Add(1, new double[] { 15, 3 });
series.Points.Add(2, new double[] { 28, 6 });
series.Points.Add(3, new double[] { 23, 5 });
series.Points.Add(4, new double[] { 35, 7 });
series.Points.Add(5, new double[] { 12, 2 });
series.Points.Add(6, new double[] { 41, 6 });
series.Points.Add(7, new double[] { 30, 5 });
this.chartControl1.Series.Add(series);
//Enable error bars to the line chart
this.chartControl1.Series[0].DrawErrorBars = true;
this.chartControl1.Series[0].ErrorBarsSymbolShape = ChartSymbolShape.Circle;
'Assign the X And Y axes
lineChart.PrimaryXAxis.ValueType = ChartValueType.Double
lineChart.PrimaryYAxis.ValueType = ChartValueType.Double
'Configure the chart series
Dim series = New ChartSeries("Series", ChartSeriesType.Line)
series.Points.Add(1, New Double() {15, 3})
series.Points.Add(2, New Double() {28, 6})
series.Points.Add(3, New Double() {23, 5})
series.Points.Add(4, New Double() {35, 7})
series.Points.Add(5, New Double() {12, 2})
series.Points.Add(6, New Double() {41, 6})
series.Points.Add(7, New Double() {30, 5})
lineChart.Series.Add(series)
'Enable error bars to the line chart
lineChart.Series(0).DrawErrorBars = True
lineChart.Series(0).ErrorBarsSymbolShape = ChartSymbolShape.Circle
Conclusion
I hope you enjoyed learning about how to display ErrorBars in WinForms Chart.
You can refer to our WinForms Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our WinForms Chart examples to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!