Skip to main content

AxisBase.Label Property

Provides access to the settings that specify the text format, position, and appearance of axis labels.

Namespace: DevExpress.XamarinForms.Charts

Assembly: DevExpress.XamarinForms.Charts.dll

NuGet Package: DevExpress.XamarinForms.Charts

Declaration

public AxisLabel Label { get; set; }

Property Value

Type Description
AxisLabel

An object that stores axis label settings.

Remarks

Axis labels display values at major tickmarks. They are automatically generated based on series’ data.

Axis Label

To configure axis labels, assign the AxisLabel object with the specified properties to the axis’s Label property.

Format Axis Label Text

The AxisLabel.TextFormat property specifies a pattern used to format text that axis labels display. Use this property if conditional formatting is not required and all labels should have the same text format.

<dxc:ChartView>
  <dxc:ChartView.AxisX>
    <dxc:DateTimeAxisX MeasureUnit="Year">
        <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>

Note

When axis labels require advanced customization (for example, conditional prefix), use an axis’s LabelTextFormatter property. It allows you to set a custom text for each label. Note that this property has a higher priority than AxisLabel.TextFormat. If both of them are specified, the label displays a formatted value that the LabelTextFormatter provides.

Set Label Position

Axis labels can be displayed inside or outside the plot area. Use the AxisLabel.Position property to change the labels’ position.

<dxc:ChartView.AxisY>
    <dxc:NumericAxisY>
        <dxc:NumericAxisY.Label>
          <dxc:AxisLabel Position="Inside"/>
        </dxc:NumericAxisY.Label>
    </dxc:NumericAxisY>
</dxc:ChartView.AxisY>

Customize Label Appearance

To change the appearance of axis labels, use the AxisLabelBase.Style property. It provides access to the AxisLabelStyle object. This object’s TextStyle property allows you to access and specify axis labels’ text appearance settings (font color and size).

<dxc:ChartView.AxisY>
    <dxc:NumericAxisY>
        <dxc:NumericAxisY.Label>
          <dxc:AxisLabel>
              <dxc:AxisLabel.Style>
                  <dxc:AxisLabelStyle>
                      <dxc:AxisLabelStyle.TextStyle>
                          <dxc:TextStyle Color="DarkGray" Size="16"/>
                      </dxc:AxisLabelStyle.TextStyle>
                  </dxc:AxisLabelStyle>
              </dxc:AxisLabel.Style>
           </dxc:AxisLabel>
        </dxc:NumericAxisY.Label>
    </dxc:NumericAxisY>
</dxc:ChartView.AxisY>

Show or Hide Axis Labels

Use the AxisLabelBase.Visible to control the visibility of axis labels.

<dxc:ChartView.AxisY>
    <dxc:NumericAxisY>
        <dxc:NumericAxisY.Label>
          <dxc:AxisLabel Visible="False"/>
        </dxc:NumericAxisY.Label>
    </dxc:NumericAxisY>
</dxc:ChartView.AxisY>
See Also