Skip to main content

AxisLabel.TextFormat Property

Gets or sets the pattern applied to axis label text.

Namespace: DevExpress.XamarinForms.Charts

Assembly: DevExpress.XamarinForms.Charts.dll

NuGet Package: DevExpress.XamarinForms.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

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:

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

Axis Label

Advanced Customization

When axis labels require advanced customization, use an axis’s LabelTextFormatter property. It 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