TreeMapPaletteColorizerBase.LegendItemPattern Property
Gets or sets the format pattern that is applied to a treemap legend item’s text.
Namespace: DevExpress.Xpf.TreeMap
Assembly: DevExpress.Xpf.TreeMap.v24.1.dll
NuGet Package: DevExpress.Wpf.TreeMap
Declaration
Property Value
Type | Description |
---|---|
String | A string that formats legend item text. |
Remarks
Patterns can contain regular text (displayed as is) and value placeholders in braces. To format numeric and date/time values, you can apply format specifiers. Use a colon to separate a placeholder and its format specifier.
The following table contains the available placeholders:
Placeholder | Description |
---|---|
{L} | Displays the group name. |
{V} | Displays the total value of group items. |
{V1} | Displays the first value of the range for a TreeMapRangeColorizer. |
{V2} | Displays the second value of the range for a TreeMapRangeColorizer. |
If a pattern starts with a placeholder in the XAML markup, insert empty brackets into the beginning of the pattern as follows: “{}{L}: {V}”. For more information, refer to the following topic: {} Escape sequence / markup extension.
Example: How to Format Legend Item Text in a Treemap
This example shows how to color treemap items based on value ranges and format the legend item text generated for each colorizer range.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TreemapExample"
xmlns:dxtm="http://schemas.devexpress.com/winfx/2008/xaml/treemap"
x:Class="TreemapExample.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<dxtm:TreeMapControl x:Name="treemap">
<dxtm:TreeMapControl.Colorizer>
<dxtm:TreeMapRangeColorizer RangeStops="0, 59, 95, 300, 1300, 2500"
LegendItemPattern="{}{V1:f0} .. {V2:f0}">
<dxtm:TreeMapRangeColorizer.Palette>
<dxtm:CustomPalette>
<Color>#D8610D</Color>
<Color>#EF802B</Color>
<Color>#FF9C11</Color>
<Color>#FFBB32</Color>
<Color>#FFCD7C</Color>
</dxtm:CustomPalette>
</dxtm:TreeMapRangeColorizer.Palette>
</dxtm:TreeMapRangeColorizer>
</dxtm:TreeMapControl.Colorizer>
<dxtm:TreeMapControl.Legend>
<dxtm:Legend HorizontalPosition="Center" VerticalPosition="BottomOutside"
Margin="10" Height="80" Padding="4">
<dxtm:Legend.Title>
<dxtm:LegendTitle Content="Assets, $B" FontSize="14" FontWeight="Bold"/>
</dxtm:Legend.Title>
</dxtm:Legend>
</dxtm:TreeMapControl.Legend>
<!-- Data binding settings are skipped. -->
</dxtm:TreeMapControl>
</Grid>
</Window>