Back to Devexpress

HeatmapKeyColorProvider.Keys Property

wpf-devexpress-dot-xpf-dot-charts-dot-heatmap-dot-heatmapkeycolorprovider.md

latest4.8 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Wpf.Charts

Declaration

csharp
public ColorizerKeysCollection Keys { get; set; }
vb
Public Property Keys As ColorizerKeysCollection

Property Value

TypeDescription
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:

xaml
<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>
                        Fast
                        Average
                        Slow
                    </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
<?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

HeatmapKeyColorProvider Class

HeatmapKeyColorProvider Members

DevExpress.Xpf.Charts.Heatmap Namespace