Back to Devexpress

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

windowsforms-117104-controls-and-libraries-chart-control-examples-chart-elements-how-to-plot-the-data-source-based-error-bars-indicator-on-a-chart.md

latest2.0 KB
Original Source

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

  • Nov 18, 2021

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.

csharp
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();
}
vb
Private Sub FormOnLoad(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    Dim view As New PointSeriesView()
    view.Indicators.Add(New DataSourceBasedErrorBars With {.ShowInLegend = True, .Name = "Prices Range", .NegativeErrorDataMember = "MinProductPrice", .PositiveErrorDataMember = "MaxProductPrice"})
    series.View = view
    series.ArgumentDataMember = "CategoryName"
    series.ValueDataMembers.AddRange(New String() { "MeanProductPrice" })
    series.DataSource = GetData()
End Sub

See Also

Error Bars