Skip to main content

SeriesBase.LegendTextPattern Property

Gets or sets a text pattern that configures strings the series provides for legend items. This is a bindable property.

Namespace: DevExpress.Maui.Charts

Assembly: DevExpress.Maui.Charts.dll

NuGet Package: DevExpress.Maui.Charts

Declaration

public string LegendTextPattern { get; set; }

Property Value

Type Description
String

The text pattern that configures strings the series provides for legend items.

Remarks

Use the LegendTextPattern property to format legend items for the series. The series generates legend items for entire series or for each series point depending on the LegendItemsBehavior property (for example, refer to the PointSeries.LegendItemsBehavior property).

The pattern can comprise regular text (which is displayed as is) and placeholders with format specifiers enclosed in braces. Placeholders define which values are shown in labels.

The following sections list the available placeholders: ChartView Placeholders and PieChartView Placeholders.

You can use standard format specifiers after the $ sign to format placeholder values.
For example, in the {V$#.##} string, V is a placeholder, $ is a format string separator, and #.## is a format string.
Refer to the following pages for more information about format specifiers:

In XAML, insert empty brackets at the beginning of a pattern if it starts with a placeholder. Refer to the following page for more information: {} Escape sequence / markup extension.

ChartView Placeholders

This section lists placeholders you can use for ChartView series.

Common Placeholders

Placeholder Description
{S} Displays the series name obtained from the SeriesBase.DisplayName property.
{A} Displays the series point argument if the series LegendItemsBehavior property is “EachPoint”.
{V} Displays the series point value if the series LegendItemsBehavior property is “EachPoint”.

Bubble Series-Specific Placeholders

This section describes placeholders specific for bubble series:

Placeholder Description
{W} Displays weight values of bubbles if the LegendItemsBehavior property of the series is “EachPoint”.

Range Series-Specific Placeholders

This section describes placeholders for range series – RangeAreaSeries and RangeBarSeries:

Placeholder Description
{LV} Displays lower values of range points if the series LegendItemsBehavior property is “EachPoint”.
{HV} Displays higher values of range points if the series LegendItemsBehavior property is “EachPoint”.

Band Colorizer-Specific Placeholders

This section contains placeholders specific for ValueBandPointColorizer:

Placeholder Description
{CLV} Displays the value that specifies the lower boundary of a color range. This placeholder can be applied if the series LegendItemsBehavior is “Series”.
{CHV} Displays the value that specifies the higher boundary of a color range. This placeholder can be applied if the series LegendItemsBehavior is “Series”.

PieChartView Placeholders

This section lists placeholders you can use for PieChartView series:

Placeholder Description
{S} Displays the pie series name obtained from the DisplayName property.
{L} Displays a pie sector’s label text. Use the PieSeriesDataAdapter.LabelDataMember property to define the data member that contains pie sector labels.
{V} Displays a pie sector’s value. Use the PieSeriesDataAdapter.ValueDataMember property to define the data member that contains pie sector values.
{VP} Displays the pie sector value as percentage in the range from 0 to 100.
{TV} Displays the center label value.

Example

In this example, the temperature curve in the spline chart is colored based on ranges of temperature values.

Line Segment Colorizer

View Example: DeVExpress .NET MAUI Charts - Colorize Line Segments

using System;
using System.Collections.Generic;

namespace SegmentColorizerExample
{
    public class ViewModel
    {
        public List<DataItem> Data { get; }
        public ViewModel()
        {
            Data = new List<DataItem>() {
                    new DataItem() { Argument = new DateTime(2018, 1, 1), Value = -17.5 },
                    new DataItem() { Argument = new DateTime(2018, 1, 10), Value = -1.4 },
                    new DataItem() { Argument = new DateTime(2018, 1, 20), Value = -22 },
                    new DataItem() { Argument = new DateTime(2018, 1, 30), Value = -26.2 },
                    new DataItem() { Argument = new DateTime(2018, 2, 10), Value = -17.5 },
                    new DataItem() { Argument = new DateTime(2018, 2, 20), Value = -15.7 },
                    new DataItem() { Argument = new DateTime(2018, 2, 28), Value = -7.8 },
                    new DataItem() { Argument = new DateTime(2018, 3, 10), Value = -8.8 },
                    new DataItem() { Argument = new DateTime(2018, 3, 20), Value = 1.3 },
                    new DataItem() { Argument = new DateTime(2018, 3, 30), Value = -7.5 },
                    new DataItem() { Argument = new DateTime(2018, 4, 10), Value = 1.5 },
                    new DataItem() { Argument = new DateTime(2018, 4, 20), Value = 8.5 },
                    new DataItem() { Argument = new DateTime(2018, 4, 30), Value = 11 },
                    new DataItem() { Argument = new DateTime(2018, 5, 10), Value = 12.2 },
                    new DataItem() { Argument = new DateTime(2018, 5, 20), Value = 13.7 },
                    new DataItem() { Argument = new DateTime(2018, 5, 30), Value = 8.3 },
                    new DataItem() { Argument = new DateTime(2018, 6, 10), Value = 15.3 },
                    new DataItem() { Argument = new DateTime(2018, 6, 20), Value = 19.1 },
                    new DataItem() { Argument = new DateTime(2018, 6, 30), Value = 22.3 },
                    new DataItem() { Argument = new DateTime(2018, 7, 10), Value = 22.2 },
                    new DataItem() { Argument = new DateTime(2018, 7, 20), Value = 24.5 },
                    new DataItem() { Argument = new DateTime(2018, 7, 30), Value = 21.4 },
                    new DataItem() { Argument = new DateTime(2018, 8, 10), Value = 21.2 },
                    new DataItem() { Argument = new DateTime(2018, 8, 20), Value = 15.6 },
                    new DataItem() { Argument = new DateTime(2018, 8, 30), Value = 15 },
                };
        }
    }
    public class DataItem
    {
        public DateTime Argument { get; set; }
        public double Value { get; set; }
    }
}
See Also