dashboard-devexpress-dot-dashboardcommon-3c382dd2.md
Provides a connection between data item containers from the Values section and series from an underlying control.
Namespace : DevExpress.DashboardCommon
Assembly : DevExpress.Dashboard.v25.2.Core.dll
NuGet Package : DevExpress.Dashboard.Core
public class ChartContext :
ControlContext
Public Class ChartContext
Inherits ControlContext
The following members return ChartContext objects:
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;
}
}
}
}
}
}
}
}
}
Imports DevExpress.DashboardCommon
Imports DevExpress.DashboardWin
Imports DevExpress.XtraCharts
' ...
Private Sub DashboardDesigner1_DashboardItemControlUpdated(ByVal sender As Object, ByVal e As DashboardItemControlEventArgs)
Private Sub DashboardDesigner1_DashboardItemControlUpdated(ByVal sender As Object, ByVal e As DashboardItemControlEventArgs)
If e.ChartControl IsNot Nothing Then
Dim designer As DashboardDesigner = CType(sender, DashboardDesigner)
Dim chartDashboardItem = TryCast(designer.Dashboard.Items(e.DashboardItemName), ChartDashboardItem)
For Each pane In chartDashboardItem.Panes
If pane.Series.Count > 0 Then
For Each dashSeries In pane.Series
If dashSeries IsNot Nothing Then
Dim controlSeries = e.ChartContext.GetChartSeries(dashSeries)
If controlSeries IsNot Nothing Then
For Each ser In controlSeries
Dim view As LineSeriesView = TryCast(ser.View, LineSeriesView)
If view IsNot Nothing Then
view.LineStyle.DashStyle = DashStyle.DashDot
End If
Next ser
End If
End If
Next dashSeries
End If
Next pane
End If
End Sub
Object ControlContext ChartContext
See Also