AxisLabel.TextFormat Property
Gets or sets the pattern applied to axis label text. This is a bindable property.
Namespace: DevExpress.Maui.Charts
Assembly: DevExpress.Maui.Charts.dll
NuGet Package: DevExpress.Maui.Charts
Declaration
public string TextFormat { get; set; }
Property Value
Type | Description |
---|---|
String | The text pattern that axis labels use to display axis values. |
Remarks
Use the TextFormat
property to specify a text pattern that axis labels use to convert axis values to strings. Each axis type requires the corresponding format:
Axis Type | Format |
---|---|
Unicode number pattern characters | |
Unicode date pattern characters |
The following example shows how to set the text format for labels of a date-time X-axis and numeric Y-axis:
<dxc:ChartView>
<dxc:ChartView.AxisX>
<dxc:DateTimeAxisX>
<dxc:DateTimeAxisX.Label>
<dxc:AxisLabel TextFormat="yyyy"/>
</dxc:DateTimeAxisX.Label>
</dxc:DateTimeAxisX>
</dxc:ChartView.AxisX>
<dxc:ChartView.AxisY>
<dxc:NumericAxisY>
<dxc:NumericAxisY.Label>
<dxc:AxisLabel TextFormat="$#K"/>
</dxc:NumericAxisY.Label>
</dxc:NumericAxisY>
</dxc:ChartView.AxisY>
</dxc:ChartView>
The resulting format string may differ depending on the target platform. For more information on text formats, refer to the following help topics:
- iOS: Number Formatting | Date Formatting
- Android: Number Formatting | Date Formatting
Advanced Customization
When axis labels require advanced customization, use an axis’ LabelTextFormatter property. This property allows you to define a custom text for each label. For example, it can be useful when you need labels to display axis values recalculated according to a specific formula or accompany values with conditional prefixes.
Note
The AxisBase.LabelTextFormatter property has a higher priority than the TextFormat
property. If both of them are specified, the label displays a formatted value that the LabelTextFormatter
provides.