Back to Devexpress

AxisLabel.TextFormat Property

maui-devexpress-dot-maui-dot-charts-dot-axislabel.md

latest3.2 KB
Original Source

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

csharp
public string TextFormat { get; set; }

Property Value

TypeDescription
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

| | --- | --- | |

NumericAxisX, NumericAxisY

|

Unicode number pattern characters

| |

DateTimeAxisX

|

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:

xaml
<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:

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.

See Also

AxisLabel Class

AxisLabel Members

DevExpress.Maui.Charts Namespace