corelibraries-devexpress-dot-xtracharts-dot-heatmap-dot-heatmapkeycolorprovider-21923460.md
Returns the collection of keys that the HeatmapKeyColorProvider uses to paint heatmap cells.
Namespace : DevExpress.XtraCharts.Heatmap
Assembly : DevExpress.XtraCharts.v25.2.dll
NuGet Package : DevExpress.Charts
public KeyCollection Keys { get; }
Public ReadOnly Property Keys As KeyCollection
| Type | Description |
|---|---|
| KeyCollection |
Contains keys for the HeatmapKeyColorProvider.
|
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.
The following example shows how to paint heatmap cells based on cell values used as keys:
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;
Dim data As DataTable = CreateDataSet("PerformanceMonitoring.xml")
heatmapControl1.DataAdapter = New HeatmapDataSourceAdapter() With {
.XArgumentDataMember = "Date",
.YArgumentDataMember = "Application",
.ColorDataMember = "Value",
.DataSource = data
}
Dim keyColorProvider As HeatmapKeyColorProvider = New HeatmapKeyColorProvider()
keyColorProvider.Keys.Add("Fast")
keyColorProvider.Keys.Add("Average")
keyColorProvider.Keys.Add("Slow")
keyColorProvider.Palette = New DevExpress.XtraCharts.Palette("Custom Palette") From {
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