Back to Devexpress

TotalLabel.TextPattern Property

corelibraries-devexpress-dot-xtracharts-dot-totallabel.md

latest3.7 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public string TextPattern { get; set; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)>
Public Property TextPattern As String

Property Value

TypeDescription
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.

PatternDescription
{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

csharp
PieSeriesView pieView = (PieSeriesView)pieChartControl.Series["Land Area"].View;
pieView.TotalLabel.Visible = true;
pieView.TotalLabel.TextPattern = "Total\r\n{TV:F2} km\xB2";
vb
Dim pieView = CType(pieChartControl.Series("Land Area").View, PieSeriesView)
pieView.TotalLabel.Visible = True
pieView.TotalLabel.TextPattern = "Total:" & vbNewLine & "{TV:F1} km" & Chr(&HB2)

See Also

Format Text Chart Elements

CustomizePieTotalLabel

CustomizeStackedBarTotalLabel

TotalLabel Class

TotalLabel Members

DevExpress.XtraCharts Namespace