Skip to main content

SeriesLabel.TextPattern Property

Gets or sets the series label text pattern.

Namespace: DevExpress.Xpf.Charts

Assembly: DevExpress.Xpf.Charts.v22.2.dll

NuGet Package: DevExpress.Wpf.Charts

Declaration

public string TextPattern { get; set; }

Property Value

Type Description
String

A String that specifies the label text pattern. The default value is String.Empty.

Remarks

Note

Series labels are hidden by default. Set the Series.LabelsVisibility property to true to display labels.

Use the TextPattern property to format label text. The TextPattern contains text and placeholders enclosed in braces. Placeholders define values that should be shown in labels. For example, the “{A}: {V}” pattern displays a series point argument and value in each label.

Note

If a pattern starts with a placeholder in the XAML markup, insert empty brackets into the beginning of the pattern as follows: “{}{A}: {V}”. For more information, refer to the following topic: {} Escape sequence / markup extension.

You can also use standard and custom format specifiers with placeholders and data field values. For example, the {V:F1} specifier shows point values with a single decimal digit.

When the chart is bound to data, the text pattern can contain data field values. For example, if the data source contains the Discount field, you can add this field to the pattern as follows: {S}: {V:F2} (Discount: {Discount:P0}).

The following tables list the placeholders that are available for the Chart Control and Chart3D Control:

Chart Control

Pattern Description
{S} Displays the series name.
Ensure the Series.DisplayName property (Series3D.DisplayName for the Chart3D Control) is specified.
{A} Displays a series point argument.
{V} Displays series point values.
{HINT} Displays the SeriesPoint.ToolTipHint property value.
Pie (Donut) series specific placeholders
{VP} Displays series point values as percentages.
{TV} Displays a total group value.
Stacked series specific placeholders
{VP} Displays series point values as percentages.
{G} Displays the name of a stacked group.
{TV} Displays a total group value.
Bubble series specific placeholders
{W} Displays the weight.
Range series specific placeholders
{V1} Displays the first value.
{V2} Displays the second value.
{VD} Displays the duration between the first and second data point values formatted with a common time format (e.g., HH:MM:SS for date time values and #.## for numeric values).
{VDTD} Displays the duration between the first and second date-time data point values in days.
{VDTH} Displays the duration between the first and second date-time data point values in hours.
{VDTM} Displays the duration between the first and second date-time data point values in minutes.
{VDTS} Displays the duration between the first and second date-time data point values in seconds.
{VDTMS} Displays the duration between the first and second date-time data point values in milliseconds.
Financial series specific placeholders
{OV} Displays the open value.
{HV} Displays the high value.
{LV} Displays the low value.
{CV} Displays the close value.
Waterfall series specific placeholders
{V} Displays a value change for a rising and falling bar in relation to the previous bar value.
{VABS} Displays an absolute point value.

Chart3D Control

Placeholder Description
{S} Displays the DisplayName of the series.
{X} Displays XAxis3D values.
{Y} Displays YAxis3D values.
{Z}, {V} Displays ZAxis3D values.
Bubble series specific placeholders
{W} Displays the weight.

If you use the {S} placeholder, make sure that the Series.DisplayName property for the Chart Control or the Series3D.DisplayName property for the Chart3D Control is specified.

You can use the Chart Control’s Pattern Editor to specify the label text pattern. For more information, refer to the following help topic: Pattern Editor.

Example

The following image shows labels with the “{}{A}: {V:F1}” pattern.

SeriesLabels_TextPattern

<dxc:ChartControl Name="chartControl1">
  <dxc:ChartControl.Diagram>
      <dxc:XYDiagram2D>
          <dxc:XYDiagram2D.Series>
              <dxc:BarSideBySideSeries2D LabelsVisibility="True" DisplayName="First Series" BarWidth="0.5">
                  <dxc:BarSideBySideSeries2D.Label>
                      <dxc:SeriesLabel TextPattern="{}{A}: {V:F1}"  
                    dxc:BarSideBySideSeries2D.LabelPosition="Outside" 
                    ResolveOverlappingMode="Default"
                    Indent="15"/>
                  </dxc:BarSideBySideSeries2D.Label>
                  <dxc:BarSideBySideSeries2D.Points>
                      <dxc:SeriesPoint Argument="A" Value="5" />
                      <dxc:SeriesPoint Argument="B" Value="4" />
                      <dxc:SeriesPoint Argument="C" Value="7" />
                      <dxc:SeriesPoint Argument="D" Value="8" />
                      <dxc:SeriesPoint Argument="E" Value="9" />
                  </dxc:BarSideBySideSeries2D.Points>
              </dxc:BarSideBySideSeries2D>
          </dxc:XYDiagram2D.Series>
      </dxc:XYDiagram2D>
  </dxc:ChartControl.Diagram>
  <dxc:ChartControl.Legend>
      <dxc:Legend />
  </dxc:ChartControl.Legend>
</dxc:ChartControl>

The following code snippets (auto-collected from DevExpress Examples) contain references to the TextPattern property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also