Skip to main content
All docs
V25.1
  • HeatmapKeyColorProvider.Keys Property

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

    Namespace: DevExpress.XtraCharts.Heatmap

    Assembly: DevExpress.XtraCharts.v25.1.dll

    NuGet Package: DevExpress.Charts

    Declaration

    public KeyCollection Keys { get; }

    Property Value

    Type Description
    KeyCollection

    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.

    DataTable data = CreateDataSet("PerformanceMonitoring.xml");
    heatmapControl1.DataAdapter = new HeatmapDataSourceAdapter() {
        XArgumentDataMember = "Date",
        YArgumentDataMember = "Application",
        ColorDataMember = "Value",
        DataSource = data
    };
    
    HeatmapKeyColorProvider keyColorProvider = new HeatmapKeyColorProvider();
    keyColorProvider.Keys.Add("Fast");
    keyColorProvider.Keys.Add("Average");
    keyColorProvider.Keys.Add("Slow");
    keyColorProvider.Palette = new DevExpress.XtraCharts.Palette("Custom Palette") {
        Color.LightGreen, Color.Yellow, Color.IndianRed };
    heatmapControl1.ColorProvider = keyColorProvider;
    

    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