Skip to main content

ColorSchemeEntry.DimensionKeys Property

Provides access to a collection of dimension keys used to specify dimension values to be colored.

Namespace: DevExpress.DashboardCommon

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


public NotifyingCollection<ColorSchemeDimensionKey> DimensionKeys { get; }

Property Value

Type Description

A collection of ColorSchemeDimensionKey objects that specify dimension values to be colored.


Use the ColorSchemeEntry.ColorDefinition property to specify the color used to color the required dimension values/measures.


The following example demonstrates how to customize a dashboard color scheme to color specified dimension values using predefined colors.

In this example, the dashboard contains Pie and Chart dashboard items, whose dimension values are colored by hue. Dimension values and corresponding colors are stored in a data table.

To add custom colors to the dashboard color scheme (the Dashboard.ColorScheme property), create the ColorSchemeEntry objects.

The ColorSchemeEntry class has the following properties:

View Example: How to Customize a Dashboard Color Scheme

using System.Data;
using System.Drawing;
using DevExpress.XtraBars.Ribbon;
using DevExpress.DashboardCommon;

namespace Dashboard_Coloring {
    public partial class Form1 : RibbonForm {
        public Form1() {

            // Create a color table that contains dimension values, measures and colors.
            DataTable colorTable = CreateColorTable();
            // Load a dashboard from the XML file.
            Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");
            IDashboardDataSource dataSource = dashboard.DataSources["dataSource1"];

            // Specify the coloring mode for the pie series, pie measures and chart argument.
            PieDashboardItem pie1 = (PieDashboardItem)dashboard.Items["pieDashboardItem1"];
            ChartDashboardItem chart1 = (ChartDashboardItem)dashboard.Items["chartDashboardItem1"];
            pie1.SeriesDimensions[0].ColoringMode = ColoringMode.Hue;
            pie1.ColoringOptions.MeasuresColoringMode = ColoringMode.Hue;
            chart1.Arguments[0].ColoringMode = ColoringMode.Hue;

            foreach (DataRow row in colorTable.Rows) {
                dashboard.ColorScheme.Add(CreateColorSchemeEntry(row, dataSource, false));
                dashboard.ColorScheme.Add(CreateColorSchemeEntry(row, dataSource, true));
            dashboardDesigner1.Dashboard = dashboard;

        // Create color scheme entries to map dimension values, measures and colors.
        private ColorSchemeEntry CreateColorSchemeEntry(DataRow colorSchemeRecord, 
                                                        IDashboardDataSource dataSource, 
                                                        bool includeMeasures) {
            DimensionDefinition categoryDefinition = new DimensionDefinition("CategoryName");
            DimensionDefinition countryDefinition = new DimensionDefinition("Country");
            MeasureDefinition priceDefinition = new MeasureDefinition("Extended Price");

            ColorSchemeEntry entry = new ColorSchemeEntry();
            entry.DimensionKeys.Add(new ColorSchemeDimensionKey(categoryDefinition, 
            entry.DimensionKeys.Add(new ColorSchemeDimensionKey(countryDefinition, 
                entry.MeasureKey = new ColorSchemeMeasureKey(priceDefinition);
            entry.ColorDefinition = new ColorDefinition((Color)colorSchemeRecord["color"]);
            entry.DataSource = dataSource;
            return entry;

        private DataTable CreateColorTable() {
            DataTable colorTable = new DataTable();
            colorTable.Columns.Add("CategoryName", typeof(string));
            colorTable.Columns.Add("Country", typeof(string));
            colorTable.Columns.Add("measure", typeof(string));
            colorTable.Columns.Add("color", typeof(Color));
            colorTable.Rows.Add("Beverages", "UK", "Extended Price", Color.Red);
            colorTable.Rows.Add("Beverages", "USA", "Extended Price", Color.Green);
            return colorTable;

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


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