AxisLabel.TextPattern Property

Gets or sets a format string that specifies the text to be displayed within the axis label.

Namespace: DevExpress.Xpf.Charts

Assembly: DevExpress.Xpf.Charts.v20.1.dll

Declaration

public string TextPattern { get; set; }
Public Property TextPattern As String

Property Value

Type Description
String

The text pattern that axis labels use to provide text representation of axis values' on which labels are located. The default value is Empty.

Remarks

Use the TextPattern property to define a pattern for displaying text by axis labels. Various placeholders enclosed in braces correspond to the available display patterns. For example, you can use either the {A} placeholder for the X-axis, or the {V} placeholder for the Y-axis. You can also use standard and custom format specifiers together with the placeholders to format numeric and date/time values (e.g., {V:F1}).

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

Chart Control

Placeholder Description
Placeholders available for arguments' axis
{A} Use it to display a series point arguments.
Placeholders available for values' axis
{V} Use it to display a series point values.
{VP} Use it to display a series point's values as a percent.

Chart3D Control

Placeholder Description
{X} Displays XAxis3D's values.
{Y} Displays YAxis3D's values.
{Z}, {V} Displays ZAxis3D's values.
NOTE

Use the "{A:q}" pattern to show quarter year on the X-axis labels.

The image below shows the TextPattern property in action with {VP:P0} patterns that are used to format axis value (Y-axis) labels.

AxisLabel_TextPattern

In addition, you can specify a pattern using the Pattern Editor (the editor that the Chart Designer invokes when you click the ellipsis button opposite the TextPattern property in the Properties window):

AxisLabel_TextPattern__PatternEditor

Examples

This example demonstrates how to customize the axis labels' text pattern. Axis labels use this pattern to provide text representation of axis values' on which labels are located.

Use the following properties to access the text pattern:

Property Description
AxisBase.Label Provides access to the settings that specify the position and text format of axis labels.
AxisLabel.TextPattern Gets or sets a format string that specifies the text to be displayed within the axis label.
<dxc:ChartControl>
    <dxc:XYDiagram2D>
        <dxc:XYDiagram2D.AxisX>
            <dxc:AxisX2D>
                <dxc:AxisX2D.Label>
                    <dxc:AxisLabel TextPattern="{}{A}"/>
                </dxc:AxisX2D.Label>
            </dxc:AxisX2D>
        </dxc:XYDiagram2D.AxisX>
        <dxc:XYDiagram2D.AxisY>
            <dxc:AxisY2D>
                <dxc:AxisY2D.Label>
                    <dxc:AxisLabel TextPattern="{}{VP:P0}"/>
                </dxc:AxisY2D.Label>
            </dxc:AxisY2D>
        </dxc:XYDiagram2D.AxisY>
    </dxc:XYDiagram2D>
</dxc:ChartControl>
See Also