Back to Devexpress

SunburstPaletteColorizerBase.LegendItemPattern Property

windowsforms-devexpress-dot-xtratreemap-dot-sunburstpalettecolorizerbase-af2d0638.md

latest3.4 KB
Original Source

SunburstPaletteColorizerBase.LegendItemPattern Property

Gets or sets the format pattern that is applied to a sunburst legend item’s text.

Namespace : DevExpress.XtraTreeMap

Assembly : DevExpress.XtraTreeMap.v25.2.dll

NuGet Package : DevExpress.TreeMap

Declaration

csharp
[XtraSerializableProperty]
public string LegendItemPattern { get; set; }
vb
<XtraSerializableProperty>
Public Property LegendItemPattern As String

Property Value

TypeDescription
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 (for example, “{V:f0}”).

The following table contains the available placeholders:

PlaceholderDescription
{L}Displays the group name.
{V}Displays the total value of group items.

Example: How to Format Legend Item Text in a Sunburst

This example shows how to color sunburst items based on value ranges and format the legend item text generated for each colorizer range.

csharp
using DevExpress.XtraTreeMap;

namespace SunburstFlatDataAdapterSample {
    public partial class MainForm : Form {

        private void OnLoad(object sender, EventArgs e) {
            ColorListLegend legend = new ColorListLegend();
            legend.Title.Text = "Revenue by Categories";
            sunburstControl.Legend = legend;

            sunburstControl.Colorizer = new SunburstPaletteColorizer {
                Palette = Palette.Office2016Palette,
                VaryColorInGroup = false,
                LegendItemPattern = "{L} - ${V}"
            };
        }
    }
}
vb
Imports DevExpress.XtraTreeMap

Namespace SunburstFlatDataAdapterSample
    Public Partial Class MainForm
        Inherits Form

        Private Sub OnLoad(ByVal sender As Object, ByVal e As EventArgs)
            Dim legend As ColorListLegend = New ColorListLegend()
            legend.Title.Text = "Revenue by Categories"
            sunburstControl.Legend = legend
            sunburstControl.Colorizer = New SunburstPaletteColorizer With {
                .Palette = Palette.Office2016Palette,
                .VaryColorInGroup = False,
                .LegendItemPattern = "{L} - ${V}"
            }
        End Sub
    End Class
End Namespace

See Also

Legend

SunburstPaletteColorizerBase Class

SunburstPaletteColorizerBase Members

DevExpress.XtraTreeMap Namespace