Back to Devexpress

WebChartControl.BoundDataChanged Event

aspnet-devexpress-dot-xtracharts-dot-web-dot-webchartcontrol-6ef695eb.md

latest5.6 KB
Original Source

WebChartControl.BoundDataChanged Event

Occurs every time a chart control generates its series points from the data source.

Namespace : DevExpress.XtraCharts.Web

Assembly : DevExpress.XtraCharts.v25.2.Web.dll

NuGet Package : DevExpress.Web.Visualization

Declaration

csharp
public event BoundDataChangedEventHandler BoundDataChanged
vb
Public Event BoundDataChanged As BoundDataChangedEventHandler

Event Data

The BoundDataChanged event's data class is EventArgs.

Remarks

Use the BoundDataChanged event to change a series’s SeriesBase.Visible property, or to change any properties of series labels or a series view.

Note

The following property values cannot be changed in the BoundDataChanged event handler:

Example

This example demonstrates how to access the auto-created series appearance settings at runtime.

Handle the WebChartControl.BoundDataChanged event to access an individual series’ settings.

View Example

csharp
private void WebChartControl_BoundDataChanged(object sender, EventArgs e) {
    Series series = webChartControl.Series.Where(s => s.Name == "2015").FirstOrDefault() as Series;
    if(series != null) {
        SideBySideBarSeriesView view = series.View as SideBySideBarSeriesView;
        if(view != null) {
            view.Color = System.Drawing.Color.Orange;
            view.FillStyle.FillMode = FillMode.Solid;
        }
    }
}
vb
Private Sub WebChartControl_BoundDataChanged(ByVal sender As Object, ByVal e As EventArgs)
    Dim series As Series = TryCast(webChartControl.Series.Where(Function(s) s.Name = "2015").FirstOrDefault(), Series)
    If series IsNot Nothing Then
        Dim view As SideBySideBarSeriesView = TryCast(series.View, SideBySideBarSeriesView)
        If view IsNot Nothing Then
            view.Color = System.Drawing.Color.Orange
            view.FillStyle.FillMode = FillMode.Solid
        End If
    End If
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the BoundDataChanged event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

webchartcontrol-how-to-change-auto-created-series-appearance/CS/BoundDataChangedExample/WebForm1.aspx.cs#L21

csharp
webChartControl.SeriesTemplate.View = new SideBySideBarSeriesView();
    webChartControl.BoundDataChanged += WebChartControl_BoundDataChanged;
}

webchartcontrol-how-to-change-auto-created-series-appearance/VB/BoundDataChangedExample/WebForm1.aspx.vb#L24

vb
webChartControl.SeriesTemplate.View = New SideBySideBarSeriesView()
    AddHandler webChartControl.BoundDataChanged, AddressOf WebChartControl_BoundDataChanged
End Sub

See Also

How to: Individually Change the View Type of Automatically Created Series

Integrate the WinForms Chart with the Pivot Grid Control

WebChartControl Class

WebChartControl Members

DevExpress.XtraCharts.Web Namespace