[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Collapse]Charts Suite
   [Collapse]Chart Control
    [Expand]Getting Started
    [Expand]Providing Data
    [Collapse]Chart Elements
       Primary and Secondary Axes
       Axis Scale Types
       Whole and Visual Ranges
       Axis Layout and Appearance
       Axis Labels
       Axis Titles
       Constant Lines
       Scale Breaks
       Tickmarks, Grid Lines, and Interlacing
      Chart Titles
    [Expand]Appearance Customization
    [Expand]End-User Features
    [Expand]Design-Time Features
    [Expand]Additional Resources
   [Expand]Chart3D Control
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Axis Labels

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:

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

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:

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 System.Windows.DataTemplate object that defines how to convert a model object to a custom label.
Axis2D.CustomLabelItemTemplateSelector Gets or sets the System.Windows.Controls.DataTemplateSelector object that defines the custom logic to select a data template that converts a model to a custom label.

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

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

Expanded 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 http://www.devexpress.com/example=T316624.

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

Expanded See Also

Is this topic helpful?​​​​​​​