Skip to main content

How to: Plot the Data Source Based Error Bars Indicator on a Chart

This example demonstrates how to plot Data Source Based Error Bars on a chart.

To do this, add a DataSourceBasedErrorBars object to the series view’s XYDiagram2DSeriesViewBase.Indicators collection. Then, specify which data members store negative and positive error values using the DataSourceBasedErrorBars.NegativeErrorDataMember and DataSourceBasedErrorBars.PositiveErrorDataMember properties.

private void FormOnLoad(object sender, EventArgs e) {
    PointSeriesView view = new PointSeriesView();
    view.Indicators.Add(new DataSourceBasedErrorBars {
        ShowInLegend = true,
        Name = "Prices Range",
        NegativeErrorDataMember = "MinProductPrice",
        PositiveErrorDataMember = "MaxProductPrice"
    });
    series.View = view;
    series.ArgumentDataMember = "CategoryName";
    series.ValueDataMembers.AddRange(new string[] { "MeanProductPrice" });
    series.DataSource = GetData();
}
See Also