wpf-devexpress-dot-xpf-dot-charts-dot-heatmap-dot-heatmapaxis-a21ceebd.md
Gets or sets a data template that specifies how to display axis custom labels.
Namespace : DevExpress.Xpf.Charts.Heatmap
Assembly : DevExpress.Xpf.Charts.v25.2.dll
NuGet Package : DevExpress.Wpf.Charts
public DataTemplate CustomLabelItemTemplate { get; set; }
Public Property CustomLabelItemTemplate As DataTemplate
| Type | Description |
|---|---|
| DataTemplate |
Specifies how to display axis custom labels.
|
To generate custom axis labels from a ViewModel, bind an axis’s CustomLabelItemsSource to a collection of objects that contain custom axis label settings. Use the CustomLabelItemTemplate or CustomLabelItemTemplateSelector property to specify how to display custom axis labels.
The following example generates custom labels for an x-axis:
<dxh:HeatmapControl>
<dxh:HeatmapControl.DataContext>
<local:MatrixHeatmapViewModel/>
</dxh:HeatmapControl.DataContext>
<!--...-->
<dxh:HeatmapControl.AxisX>
<dxh:HeatmapAxis LabelVisibilityMode="AutoGeneratedAndCustom"
CustomLabelItemsSource="{Binding CustomLabels}">
<dxh:HeatmapAxis.CustomLabelItemTemplate>
<DataTemplate>
<dxc:CustomAxisLabel Value="{Binding AxisValue}"
Content="{Binding Text}"/>
</DataTemplate>
</dxh:HeatmapAxis.CustomLabelItemTemplate>
</dxh:HeatmapAxis>
</dxh:HeatmapControl.AxisX>
</dxh:HeatmapControl>
using System.Collections.Generic;
using System.Windows;
namespace HeatmapChart {
public class MatrixHeatmapViewModel {
public string[] XArguments { get; set; }
public string[] YArguments { get; set; }
public double[,] Values { get; set; }
public List<CustomLabel> CustomLabels { get; set; }
public MatrixHeatmapViewModel() {
XArguments = new string[] { "March", "April", "May", "June", "July" };
YArguments = new string[] { "Accessories", "Bikes", "Clothing", "Components" };
Values = new double[,] {
{ 214.3, 530.1, 630.2, 854.4, 313.4 },
{ 321.3, 514.4, 281.3, 533.4, 541.9 },
{ 604.3, 429.1, 632.6, 438.4, 265.4 },
{ 485.3, 544.7, 740.3, 661.4, 516.6 }
};
CustomLabels = new List<CustomLabel> {
new CustomLabel{ AxisValue = "April", Text = "April (04/30)" },
new CustomLabel{ AxisValue = "May", Text = "May (05/31)" },
};
}
}
public class CustomLabel {
public string AxisValue { get; set; }
public string Text { get; set; }
}
}
Imports System.Collections.Generic
Namespace HeatmapChart
Public Class MatrixHeatmapViewModel
Public Property XArguments As String()
Public Property YArguments As String()
Public Property Values As Double(,)
Public Property CustomLabels As List(Of CustomLabel)
Public Sub New()
XArguments = New String() {"March", "April", "May", "June", "July"}
YArguments = New String() {"Accessories", "Bikes", "Clothing", "Components"}
Values = New Double(,) {
{214.3, 530.1, 630.2, 854.4, 313.4},
{321.3, 514.4, 281.3, 533.4, 541.9},
{604.3, 429.1, 632.6, 438.4, 265.4},
{485.3, 544.7, 740.3, 661.4, 516.6}}
CustomLabels = New List(Of CustomLabel) From {
New CustomLabel With {
.AxisValue = "April",
.Text = "April (04/30)"
},
New CustomLabel With {
.AxisValue = "May",
.Text = "May (05/31)"
}
}
End Sub
End Class
Public Class CustomLabel
Public Property AxisValue As String
Public Property Text As String
End Class
End Namespace
See Also