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.v24.1.dll
NuGet Package: DevExpress.Wpf.Charts
Declaration
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.
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):
Example
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 | Specifies axis label settings. |
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>
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference 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.