Back to Devexpress

AxisBase.LabelTextFormatter Property

maui-devexpress-dot-maui-dot-charts-dot-axisbase-260c5d3b.md

latest2.0 KB
Original Source

AxisBase.LabelTextFormatter Property

Gets or sets an object that provides custom string representations of axis label values to labels. This is a bindable property.

Namespace : DevExpress.Maui.Charts

Assembly : DevExpress.Maui.Charts.dll

NuGet Package : DevExpress.Maui.Charts

Declaration

csharp
public IAxisLabelTextFormatter LabelTextFormatter { get; set; }

Property Value

TypeDescription
IAxisLabelTextFormatter

The object that provides custom string representations of axis label values to labels.

|

Example

This example illustrates how to use the text formatter to assign a custom text to axis labels:

xml
<dxc:DateTimeAxisX>
    <dxc:DateTimeAxisX.LabelTextFormatter>
            <local:AxisLabelTextFormatter/>
    </dxc:DateTimeAxisX.LabelTextFormatter>
</dxc:DateTimeAxisX>
csharp
public class AxisLabelTextFormatter : IAxisLabelTextFormatter {
    // Accepts an axis value that should be formatted.
    public string Format(object value) {
        if (value is DateTime dateTime) return dateTime.ToString("MM/dd/yy");
        return String.Empty;
    }
}

The code above uses the following classes and members:

|

Symbol

|

Description

| | --- | --- | |

AxisBase.LabelTextFormatter

|

Gets or sets an object that provides custom string representations of axis label values to labels. This is a bindable property.

| |

IAxisLabelTextFormatter

|

An interface that should be implemented by a class that defines custom labels for an axis.

|

See Also

AxisBase Class

AxisBase Members

DevExpress.Maui.Charts Namespace