Loading...
Loading...
Implement Syncfusion WPF Heat Map (SfHeatMap) control for matrix-based data visualization using color gradients. Use this when visualizing tabular data with color-coded cells, creating heat map charts, or displaying data density patterns. This skill covers data mapping, color palette configuration, legend customization, and cell label formatting for WPF applications.
npx skill4agent add syncfusion/wpf-ui-components-skills syncfusion-wpf-heatmapSfHeatMapTableMappingCellMappingSfHeatMapItemsSourceItemsMappingColorMappingCollectionSfHeatMapLegend<Window xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="HeatMapSamples.MainWindow">
<Window.Resources>
<!-- Define semantic buckets: low=red, mid=yellow, high=green -->
<syncfusion:ColorMappingCollection x:Key="semanticColorMapping">
<!-- Value = numeric stop; Legend uses the Label text -->
<syncfusion:ColorMapping Value="0" Color="#FF0000" Label="Low (0 - 33)" />
<syncfusion:ColorMapping Value="33" Color="#FFFF00" Label="Medium (34 - 66)" />
<syncfusion:ColorMapping Value="66" Color="#00B300" Label="High (67 - 100)" />
</syncfusion:ColorMappingCollection>
<!-- CellMapping for row/column/value triplets -->
<syncfusion:CellMapping x:Key="cellMapping">
<syncfusion:CellMapping.Column>
<syncfusion:ColumnMapping PropertyName="Column" DisplayName="Column" />
</syncfusion:CellMapping.Column>
<syncfusion:CellMapping.Row>
<syncfusion:ColumnMapping PropertyName="Row" DisplayName="Row" />
</syncfusion:CellMapping.Row>
<syncfusion:CellMapping.Value>
<syncfusion:ColumnMapping PropertyName="Value" />
</syncfusion:CellMapping.Value>
</syncfusion:CellMapping>
</Window.Resources>
<Grid Margin="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Legend explains the semantic buckets clearly -->
<syncfusion:SfHeatMapLegend
Grid.Row="0"
LegendMode="List"
Orientation="Horizontal"
ColorMappingCollection="{StaticResource semanticColorMapping}" />
<!-- The HeatMap uses the same ColorMappingCollection -->
<syncfusion:SfHeatMap
Grid.Row="1"
ItemsSource="{Binding Cells}"
ItemsMapping="{StaticResource cellMapping}"
ColorMappingCollection="{StaticResource semanticColorMapping}" />
</Grid>
</Window>// Minimal code-behind (MainWindow.xaml.cs)
using System.Collections.ObjectModel;
using System.Windows;
public class CellData
{
public string Row { get; set; }
public string Column { get; set; }
public double Value { get; set; }
}
public partial class MainWindow : Window
{
public ObservableCollection<CellData> Cells { get; } = new ObservableCollection<CellData>();
public MainWindow()
{
InitializeComponent();
// sample values spanning 0..100
Cells.Add(new CellData { Row = "R1", Column = "C1", Value = 10 });
Cells.Add(new CellData { Row = "R1", Column = "C2", Value = 40 });
Cells.Add(new CellData { Row = "R1", Column = "C3", Value = 80 });
Cells.Add(new CellData { Row = "R2", Column = "C1", Value = 25 });
Cells.Add(new CellData { Row = "R2", Column = "C2", Value = 55 });
Cells.Add(new CellData { Row = "R2", Column = "C3", Value = 95 });
DataContext = this;
}
}ColorMappingCollectionSfHeatMapLegend LegendMode="List"ValueValueTableMappingCellMappingTableMappingCellMappingGradientListOrientationColorMappingCollectionItemsMappingItemsSource