Skip to main content
All docs
V25.1
  • 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.1.dll

    NuGet Package: DevExpress.TreeMap

    Declaration

    [XtraSerializableProperty]
    public string LegendItemPattern { get; set; }

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

    The following table contains the available placeholders:

    Placeholder Description
    {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.

    A sunburst with formatted legend text

    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}"
                };
            }
        }
    }
    
    See Also