Share via


Error Bar Chart

The Error Bar chart type consists of lines with markers that are used to display statistical information about the data displayed in a graph. A series of the Error Bar chart type has three Y values. While these values can be manually assigned to each point, in most cases, the values are calculated from the data present in another series. The order of the Y values is important because each position in the array of values represents a value on the error bar.

Chart Characteristics

SeriesChartType value

SeriesChartType.ErrorBar

Number of Y values per point

3 (see table below).

Number of series

1

Supports markers

Yes

Cannot be combined with:

Doughnut, Pie, or Bar charts.

Custom attributes

DrawSideBySide, ErrorBarCenterMarkerStyle, ErrorBarSeries, ErrorBarStyle, ErrorBarType, MaxPixelPointWidth, MinPixelPointWidth, PixelPointDepth, PixelPointGapDepth, PixelPointWidth, PointWidth

An Error Bar series uses three Y values. The ordering of the Y values is important because each Y value represents a point on the chart.

Y Values Index

Description

0

Center or average point value.

1

Lower error value.

2

Upper error value.

Remarks

By default, the Error Bar chart shows both lower, and upper errors. To show only one of the error points, use the ErrorBarStyle custom attribute.

The DataPoint.MarkerStyle property applies to the error bar markers, whereas the ErrorBarCenterMarkerStyle applies to the center value marker. The markers are not set by default, and the upper and lower error values are horizontal lines are displayed as horizontal lines in the Error Bar chart.

Calculating Error Values from Another Series

In most of the cases the data point values of the Error Bar chart are calculated using formulas applied to data existing in other series. To do so, use the ErrorBarSeries custom attribute to attach the Error Bar chart to another pre-existing series, and then use the ErrorBarType custom attribute to define the formula to calculate the error values. This also enables you to view the error bars for any series, even at design-time. Follow the steps below:

  1. Set ErrorBarSeries to the name of the Series object you want to use, or specify it along with the Y value index in the following format: "Name:Yindex".

    If you specify the data series without the Y value index, then the chart uses the first Y value of each data point by default.

  2. Assign a formula to the ErrorBarType custom attribute in the following format: "FormulaName(Parameter1, Parameter2, …)". See the following table for the available formulas.

Note

These formulas are not the same as the financial or statistical formulas described in Formulas.

Formula Name

Parameter

Description

Fixed Value

Required

Calculate the error margin as a fixed value difference from the center value.

Percentage

Optional

Calculate the error margin as a percentage of the center value. If the parameter is not specified, a 10% error margin is used.

StandardDeviation

Optional

Error values are determined by applying a standard deviation calculation to the center values present in the error bar series. If the parameter is not specified, then a standard deviation value of 1 is used.

StandardError

Optional

Error values are determined by applying a standard error calculation to the center values in the error bar series. If the parameter is not specified, then a standard error value of 1 is used.

Example

The following code demonstrates applying how to apply the error bar chart to the third Y values (Y2) of the Price data series by applying a standard deviation calculation to the series.

Chart1.Series("Series1")("ErrorBarSeries")="Price:Y2"
Chart1.Series("Series1")("ErrorBarType")="StandardDeviation()"
Chart1.Series["Series1"]["ErrorBarSeries"]="Price:Y2";
Chart1.Series["Series1"]["ErrorBarType"]=" StandardDeviation()";

See Also

Reference

Chart Types

System.Windows.Forms.DataVisualization.Charting

System.Web.UI.DataVisualization.Charting