Skip to main content

ChartContext Class

Provides a connection between data item containers from the Values section and series from an underlying control.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v24.2.Core.dll

Declaration

public class ChartContext :
    ControlContext

Remarks

A chart context provides the connection between dashboard data item containers from the Values section and the underlying control’s series. The GetControlSeries method returns a data item container that corresponds to the specified control’s series. The GetDashboardItemColumn method, in turn, gets a collection of the control’s series that corresponds to the specified data item containers from the Values section.

The following code shows how to change the standard line to a line consisting of a repeating pattern of dash-dot. The Chart contains two panes with Total Sum and Quantity data items. The series contains two values. The DashboardDesigner.DashboardItemControlUpdated event is used to update the Chart’s appearance.

using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using DevExpress.XtraCharts;

// ...

private void DashboardDesigner1_DashboardItemControlUpdated(object sender, DashboardItemControlEventArgs e) {
    if(e.ChartControl != null) {
        DashboardDesigner designer = (DashboardDesigner)sender;
        var chartDashboardItem = designer.Dashboard.Items[e.DashboardItemName] as ChartDashboardItem;

        foreach(var pane in chartDashboardItem.Panes) {
            if(pane.Series.Count > 0) {
                foreach(var dashSeries in pane.Series) {
                    if(dashSeries != null) {
                        var controlSeries = e.ChartContext.GetChartSeries(dashSeries);
                        if(controlSeries != null) {
                            foreach(var ser in controlSeries) {
                                LineSeriesView view = ser.View as LineSeriesView;
                                if(view != null) {
                                    view.LineStyle.DashStyle = DashStyle.DashDot;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Inheritance

See Also