Skip to main content
All docs
V23.2

HeatmapKeyColorProvider.Keys Property

Returns the collection of keys that the HeatmapKeyColorProvider uses to paint heatmap cells.

Namespace: DevExpress.Xpf.Charts.Heatmap

Assembly: DevExpress.Xpf.Charts.v23.2.dll

NuGet Package: DevExpress.Wpf.Charts

Declaration

public ColorizerKeysCollection Keys { get; set; }

Property Value

Type Description
ColorizerKeysCollection

Contains keys for the HeatmapKeyColorProvider.

Remarks

Populate the Keys collection with key values to specify the order in which the palette colors are assigned to keys. Depending on the heatmap adapter, use values from the HeatmapMatrixAdapter.Values collection, or from a data source field that the ColorDataMember specifies. If the Keys collection is empty, colors are applied to cells in the order in which values first appear in the source.

Example

The following example shows how to paint heatmap cells based on cell values used as keys:

Heatmap cells are painted based on key values.

<dx:ThemedWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:dxh="http://schemas.devexpress.com/winfx/2008/xaml/heatmap" 
    xmlns:System="clr-namespace:System;assembly=mscorlib" 
    xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" 
    x:Class="HeatmapKeyColorProviderSample.MainWindow"
    Title="MainWindow" Height="800" Width="1000">
    <Grid>
        <dxh:HeatmapControl>

            <dxh:HeatmapControl.ColorProvider>                
                <dxh:HeatmapKeyColorProvider>
                    <dxh:HeatmapKeyColorProvider.Keys>
                        <System:String>Fast</System:String>
                        <System:String>Average</System:String>
                        <System:String>Slow</System:String>
                    </dxh:HeatmapKeyColorProvider.Keys>
                    <dxh:HeatmapKeyColorProvider.Palette>
                        <dxc:CustomPalette>
                            <dxc:CustomPalette.Colors>
                                <Color>LightGreen</Color>
                                <Color>Yellow</Color>
                                <Color>IndianRed</Color>
                            </dxc:CustomPalette.Colors>
                        </dxc:CustomPalette>
                    </dxh:HeatmapKeyColorProvider.Palette>
                </dxh:HeatmapKeyColorProvider>
            </dxh:HeatmapControl.ColorProvider>

            <dxh:HeatmapDataSourceAdapter DataSource="{Binding}" 
                                          XArgumentDataMember="Date" 
                                          YArgumentDataMember="Application" 
                                          ColorDataMember="Value"/>
        </dxh:HeatmapControl>
    </Grid>
</dx:ThemedWindow>

The structure of an XML file that is used as a data source appears as follows:

Show XML
<?xml version="1.0"?>
<PerformanceMonitoring xmlns:xsi="http://www.w3.org/2001/XMLSchema/instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Performance">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="Date" type="xs:string"/>
          <xs:element name="Application" type="xs:string"/>
          <xs:element name="Value" type="xs:string"/>
        </xs:sequence>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <Performance>
    <Date>2018/01/01</Date>
    <Application>Register</Application>
    <Value>Average</Value>
  </Performance>
  <Performance>
    <Date>2018/01/01</Date>
    <Application>Login</Application>
    <Value>Slow</Value>
  </Performance>
  <Performance>
    <Date>2018/01/01</Date>
    <Application>Logout</Application>
    <Value>Fast</Value>
  </Performance>
  <!--...-->
</PerformanceMonitoring>  
See Also