HeatmapAxis.CustomLabelItemsSource Property
Gets or sets the collection of View Model objects that is used to create custom labels.
Namespace: DevExpress.Xpf.Charts.Heatmap
Assembly: DevExpress.Xpf.Charts.v24.2.dll
NuGet Package: DevExpress.Wpf.Charts
Declaration
Property Value
Type | Description |
---|---|
IEnumerable | A collection that is used to generate custom labels. |
Remarks
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.
Example
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; }
}
}
See Also