Skip to main content

DashboardItemControlEventArgs.ChartContext Property

Gets the chart context.

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v24.1.Win.dll

NuGet Package: DevExpress.Win.Dashboard

Declaration

public ChartContext ChartContext { get; }

Property Value

Type Description
ChartContext

A context used to provide a connection between data item containers from the Values section and underlying control’s series.

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;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

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

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.

See Also