TotalLabel.TextPattern Property
Gets or sets the text pattern the Chart Control uses to generate the Total Label’s text.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.1.dll
NuGet Package: DevExpress.Charts
Declaration
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
[XtraSerializableProperty]
public string TextPattern { get; set; }
Property Value
Type | Description |
---|---|
String | The text pattern. The default value is Empty. |
Remarks
Use the TextPattern property to define a pattern for a text that total labels display. Various placeholders enclosed in braces correspond to the available display patterns. For example, a pair of placeholders specified together (e.g., {A} - {V}), will cause each data point to be represented by both its argument and value, separated by a hyphen.
Note
Total labels are hidden by default for a series. To see how the TextPattern property affects the label format, set the TotalLabel.Visible property to true.
A full list of available placeholders is detailed below.
Pattern | Description |
---|---|
{S} | Displays the name of the series. |
{G} | Displays the name of a stacked group. |
{A} | Displays a series point argument. |
{TV} | Displays total group value. |
You can also use standard and custom format specifiers, together with the placeholders (e.g., {TV:F1}).
Note
Before specifying the {S} placeholder for a series, make sure a series name is specified in the Series.DisplayName property.
To use X-axis quarter year values within a label text, use the “{A:q}” pattern.
To learn more, refer to the Format Specifiers topic in MSDN.
In addition, you can specify a pattern using the Pattern Editor (the editor is invoked by clicking the ellipsis button of the TextPattern property in the Properties window of the Chart Designer).
Example
PieSeriesView pieView = (PieSeriesView)pieChartControl.Series["Land Area"].View;
pieView.TotalLabel.Visible = true;
pieView.TotalLabel.TextPattern = "Total\r\n{TV:F2} km\xB2";