Axis Labels

  • 5 minutes to read

The Chart control provides default and custom axis labels. Default labels are generated automatically based on series' data.


This document consists of the following sections:

How to Configure Custom Labels

You can create custom axis labels and modify their position and content. The Chart Control can display custom and default labels simultaneously. The following image shows custom axis labels for a y-axis:


Use the markup below to configure custom axis labels:

      <dxc:AxisY2D LabelVisibilityMode="Default"
                  <dxc:CustomAxisLabel Value="120" Content="2h"/>
                  <dxc:CustomAxisLabel Value="360" Content="6h"/>
                  <dxc:CustomAxisLabel Value="600" Content="10h"/>
                  <dxc:CustomAxisLabel Value="840" Content="14h"/>

The following API members allow you to configure axis custom labels:

Class or Property Description
Axis2D.CustomLabels The custom axis labels' collection. If this collection is empty, a Chart control displays default axis labels.
CustomAxisLabel An individual custom axis label.
CustomAxisLabel.Value An axis value that specifies a custom label's position.
CustomAxisLabel.Content A custom label's content.
Axis2D.LabelVisibilityMode Specifies whether to show custom with default axis labels or only display custom labels.

The MVVM Design Pattern's Use

To generate custom axis labels from a ViewModel, bind the Axis2D.CustomLabelItemsSource property to a collection of objects that contain custom axis labels' parameters. Use the Axis2D.CustomLabelItemTemplate or Axis2D.CustomLabelItemTemplateSelector property to specify how to convert a model object to a custom label.

The following example shows how to generate custom labels for a y-axis:


    <dxc:AxisY2D x:Name="axisY" 
                 CustomLabelItemsSource="{Binding CustomLabels}"> 
                <dxc:CustomAxisLabel Value="{Binding Item1}" 
                                     Content="{Binding Item2}"/> 

You can use the API members in the following table to generate custom labels from a View Model:

Member Description
Axis2D.CustomLabelItemsSource Gets or sets the collection that is used to generate custom labels.
Axis2D.CustomLabelItemTemplate Specifies the DataTemplate object that defines how to convert a model object to a custom label.
Axis2D.CustomLabelItemTemplateSelector Gets or sets the DataTemplateSelector object that defines the custom logic to select a data template that converts a model to a custom label.

How to Apply an Axis Label Text Pattern

Use the predefined placeholders, format specifiers and plain text to set a pattern that defines a label's text. In the image below, the {V} min pattern is applied to the y-axis labels.


The following markup shows how to configure the label's text pattern:

      <dxc:AxisY2D GridLinesMinorVisible="False" 
                  <dxc:AxisLabel TextPattern="{}{V} min"/>

The code above uses the following classes and properties:

Class or Property Description
AxisLabel.TextPattern Specifies a text pattern.
AxisBase.Label Specifies the label settings.
AxisLabel The axis label settings' storage.

The following table lists all the available placeholders:

Pattern Description
{A} Displays series point arguments (only for arguments axes).
{V} Displays series point values (only for values axes).
{VP} Displays series point values as a percentage (only for values axes).

How to Resolve Axis Label Overlapping

The Chart Control provides the Resolve Overlapping algorithm that rotates, staggers and hides axis labels when they are too long and do not have enough space to display all the information. You can use the Resolve Overlapping options to configure this algorithm. Axis labels overlap when the Resolve Overlapping options are disabled.


The following animation shows how the Resolve Overlapping algorithm works:


The following XAML demonstrates how to use AxisLabelResolveOverlappingOptions to configure the Resolve Overlapping algorithm's options:


A complete sample project is available in the DevExpress Code Examples database at

            <dxc:ManualDateTimeScaleOptions MeasureUnit="Hour"
                        AutoGrid="False" />
            <dxc:AxisLabel TextPattern="{}{A:dd/MM HH:mm}">
                    <dxc:AxisLabelResolveOverlappingOptions AllowHide="True"
                                MinIndent="5" />

You can use the following properties to configure the Resolve Overlapping algorithm's options:

Member Description
AxisLabelResolveOverlappingOptions Settings that allow you to modify axis labels' position to prevent overlapping labels.
Axis2D.ResolveOverlappingOptions Gets or sets the settings that allow you to avoid overlapping axis labels.
AxisLabelResolveOverlappingOptions.AllowHide Gets or sets the value that indicates whether to hide axis labels to prevent overlapping labels.
AxisLabelResolveOverlappingOptions.AllowRotate Specifies the value that indicates whether to rotate axis labels.
AxisLabelResolveOverlappingOptions.AllowStagger Gets or sets the value that indicates whether to stagger axis labels to avoid overlapping labels.
AxisLabelResolveOverlappingOptions.MinIndent Gets or sets the minimum indent between adjacent axis labels when an overlap resolution algorithm is applied to them.

The AllowRotate and AllowStagger properties only affect labels of a horizontal 2D XY Diagram axis (an arguments x-axis or values y-axis when XYDiagram2D.Rotated is enabled).

See Also