The requested page is not available for the requested platform. You are viewing the content for Default platform.

DashboardViewer.DashboardItemElementCustomColor Event

Allows you to color the required dashboard item elements using the specified colors.

Namespace: DevExpress.DashboardWin

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

Declaration

public event DashboardItemElementCustomColorEventHandler DashboardItemElementCustomColor
Public Event DashboardItemElementCustomColor As DashboardItemElementCustomColorEventHandler

Event Data

The DashboardItemElementCustomColor event handler receives an argument of the DashboardItemElementCustomColorEventArgs type. The following properties provide information specific to this event.

Property Description
Color Gets or sets the color of the dashboard item element.
DashboardItemName Gets the component name of the dashboard item for which the event was raised.
Data Gets multidimensional data displayed in the dashboard item.
Measures Gets measures corresponding to the current dashboard item element.
TargetElement Gets the axis point tuple corresponding to the current dashboard item element.

Remarks

The DashboardItemElementCustomColor event allows you to color the required dashboard item elements (for instance, chart series points, pie segments or scatter chart points) using the specified colors. The DashboardItemElementCustomColorEventArgs class exposes the following settings that allow you to color the required element.

Note

By default, the Chart dashboard item colors lines (or fills areas) for the Line/Area series types using the color of the first series point. For these lines/areas, the DashboardItemElementCustomColorEventArgs.TargetElement property returns a tuple that does not contain the AxisPoint on the DashboardDataAxisNames.ChartArgumentAxis.

Important

Note that color modifications applied using the DashboardItemElementCustomColor event are not applied in the resulting exported document.

Examples

The following example demonstrates how to color dashboard item elements using the DashboardViewer.DashboardItemElementCustomColor event.

In this example, chart series points, whose values exceed specified thresholds, are colored in green. Chart series points, whose values fall below specified thresholds, are colored in red.

Pie segments, whose contributions in total fall below the specified threshold, are colored in orange.

Imports System.Drawing
Imports DevExpress.XtraEditors
Imports DevExpress.DashboardWin
Imports DevExpress.DashboardCommon
Imports DevExpress.DashboardCommon.ViewerData

Namespace Dashboard_ElementCustomColor
    Partial Public Class Form1
        Inherits XtraForm

        Public Sub New()
            InitializeComponent()
            dashboardViewer1.LoadDashboard("..\..\Data\Dashboard.xml")
        End Sub

        Private Sub dashboardViewer1_DashboardItemElementCustomColor(ByVal sender As Object, _
                                     ByVal e As DashboardItemElementCustomColorEventArgs) _
                                 Handles dashboardViewer1.DashboardItemElementCustomColor

            Dim data As MultiDimensionalData = e.Data
            Dim currentElement As AxisPointTuple = e.TargetElement

            If e.DashboardItemName = "chartDashboardItem1" Then
                Dim country As String = _
                    currentElement.GetAxisPoint(DashboardDataAxisNames.ChartSeriesAxis).Value.ToString()
                Dim value As Decimal = _
                    CDec((data.GetSlice(currentElement)).GetValue(e.Measures(0)).Value)
                If country = "UK" AndAlso value > 50000 OrElse country = "USA" AndAlso value > 100000 _
                    Then
                    e.Color = Color.DarkGreen
                Else
                    e.Color = Color.DarkRed
                End If
            End If
            If e.DashboardItemName = "pieDashboardItem1" Then
                Dim value As Decimal = _
                    CDec((data.GetSlice(currentElement)).GetValue(data.GetMeasures()(0)).Value)
                If value < 100000 Then
                    e.Color = Color.Orange
                End If
            End If
        End Sub
    End Class
End Namespace
See Also