[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
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Collapse]Spreadsheet
    Product Structure
   [Expand]Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
   [Expand]Charts and Graphics
    Printing
    Events
    Protection
    Operation Restrictions
    Find and Replace
   [Expand]Mail Merge
   [Expand]Visual Elements
    Services
    Themes and Templates
   [Expand]Shortcuts
   [Collapse]Examples
    [Expand]Files
    [Expand]Workbooks
    [Expand]Worksheet
    [Expand]Rows and Columns
    [Expand]Cells
    [Expand]Formulas
    [Expand]Data Binding
    [Expand]Formatting Cells
    [Expand]Conditional Formatting
    [Expand]Group Data
    [Expand]Filter Data
    [Expand]Tables
    [Expand]Pivot Tables
    [Expand]Printing
    [Expand]Pictures
    [Expand]Shapes
    [Collapse]Charts
      How to: Create and Modify a Chart
      How to: Create a Stock Chart
      How to: Format Chart Elements
      How to: Change the Color of Series Points
      How to: Display the Chart Title
      How to: Display and Format Data Labels
      How to: Show or Hide the Chart Legend
      How to: Change the Display of Chart Axes
      How to: Protect a Chart
      How to: Create a Chart Sheet
      How to: Move a Chart to a Chart Sheet
      How to: Specify Chart Sheet Print Options
      How to: Remove a Chart Sheet
      How to: Protect a Chart Sheet
    [Expand]Sparklines
    [Expand]Protection
    [Expand]Mail Merge
    [Expand]Cell Templates
    [Expand]Commands
    [Expand]Customization
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [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
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Change the Display of Chart Axes

When you create a chart, its primary axes are generated automatically depending on the chart type. Most charts have two primary axes: the category axis (X-axis), usually running horizontally at the bottom of the plot area, and the value axis (Y-axis), usually running vertically on the left side of the plot area. 3-D charts also have the depth (or series) axis along which the series names are displayed. But some charts, like a pie or doughnut chart, have no axes at all.

If the chart type you selected supports axes, you can modify them by displaying axis tick marks and gridlines, changing the axis position, applying formatting options, specifying the axis scaling, adding secondary axes, etc.

Select the action you wish to perform.

Expanded Display or Hide Primary Axes

All primary axes are stored in the primary axis collection (AxisCollection), accessible using the ChartObject.PrimaryAxes property. An individual axis defined by the Axis object can be accessed using the indexer notation (0 for the category axis, 1 for the value axis and 2 for the depth axis if it is present). To display or hide a primary axis, utilize the Axis.Visible property. To position an axis on the chart, use the Axis.Position property.

Note

The complete sample project is available in the DevExpress-Examples/wpf-spreadsheet-chart-api-t113198 repository on GitHub.

Expanded Add Axis Titles

For both primary and secondary axes in the chart, it's possible to add and customize their text titles, which can be used to clarify data displayed along the axes.

The axis titles are not shown by default. However, you can add a title to any horizontal, vertical, or depth axes by utilizing the Axis.Title property, which accesses the ChartTitleOptions object containing display settings for axis titles. This object inherits the ChartText interface which provides methods used to specify the title text. Thus, to add the axis title, set the ChartTitleOptions.Visible property to true, and then do one of the following.

Note

The complete sample project is available in the DevExpress-Examples/wpf-spreadsheet-chart-api-t113198 repository on GitHub.

Expanded Specify Scaling Options

By default, the minimum and maximum scale values for the numerical axis are evaluated automatically based on the data used by the chart. However, you can control the axis scaling by using the Axis.Scaling property, which gets the AxisScaling object. The object's properties allow you to control the minimum (AxisScaling.Min) and maximum (AxisScaling.Max) values of the axis, change the numerical axis to logarithmic (AxisScaling.LogScale and AxisScaling.LogBase) and specify the axis orientation (AxisScaling.Orientation).

The example below demonstrates how to create a clustered column chart and specify the value axis scale. Set the AxisScaling.AutoMax and AxisScaling.AutoMin properties to false to indicate that maximum and minimum values of the axis will be set manually by using the AxisScaling.Max and AxisScaling.Min properties

Note

The complete sample project is available in the DevExpress-Examples/wpf-spreadsheet-chart-api-t113198 repository on GitHub.

Expanded Format Numbers on the Axis

You can specify how to display numeric values on the axis by applying number formats. Numbers in the axis labels can appear as percentage, decimal, currency, scientific, fraction, text, accounting, date, time, or custom values. To apply a number format to tick-mark labels, utilize the Axis.NumberFormat property. This property provides access to the NumberFormatOptions object that contains format options for displaying numbers in chart elements. Assign the corresponding number format code to the NumberFormatOptions.FormatCode property, and set the NumberFormatOptions.IsSourceLinked property to false to indicate that the applied format differs from the number format of the worksheet cell.

Note

The complete sample project is available in the DevExpress-Examples/wpf-spreadsheet-chart-api-t113198 repository on GitHub.

Expanded Display Secondary Axes

When data on a chart vary widely and the scale difference is huge, or when you combine different types of data on a combination chart, you can plot one or more data series along secondary axes.

To display secondary axes for a specific series, assign the AxisGroup.Secondary value to the Series.AxisGroup property. Note that you cannot make all the series on the chart secondary. An exception occurs when you try to change the axis group for the only primary series on a chart or for a series whose chart type does not allow secondary axes.

If the secondary axes were created successfully, they are added to the secondary axis collection (accessible using the ChartObject.SecondaryAxes property) and treated separately from the primary axes. You can get an individual secondary axis defined by the Axis object by its index in the collection (0 for the secondary category axis and 1 for the secondary value axis). For the secondary axes, you can specify the same set of axis options that the primary axes have: for example, you can set the secondary axis position, adjust scaling options, add the axis title, etc.

Note

The complete sample project is available in the DevExpress-Examples/wpf-spreadsheet-chart-api-t113198 repository on GitHub.

Expanded Display or Hide Axis Tick Marks and Gridlines

When you create a chart, it adds major tick marks to each axis by default. Tick marks are tiny lines used to indicate the demarcation of the axis. You can hide major tick marks or adjust their placement by using the Axis.MajorTickMarks property. To display and position minor tick marks, use the Axis.MinorTickMarks property. You can also specify how many tick marks should appear on the axis by changing the distance between the major and minor tick marks via the Axis.MajorUnit and Axis.MinorUnit properties.

Each major tick mark on the axis is accompanied by a tick-mark label - a textual identifier that explains the meaning of the axis units. Tick-mark labels are generated automatically based on the data displayed along the axis. However, you can remove axis labels from the chart by setting the Axis.TickLabelPosition property to AxisTickLabelPosition.None. You can also apply number format to the numerical values displayed in the labels.

The following example demonstrates how to create the clustered column chart and hide the axis major tick marks by setting the Axis.MajorTickMarks property to the AxisTickMarks.None value.

Note

The complete sample project is available in the DevExpress-Examples/wpf-spreadsheet-chart-api-t113198 repository on GitHub.

To improve the readability of a chart, you can display gridlines - a series of horizontal and vertical lines running across the plot area. By default, the chart displays major gridlines for the primary value axis to help you to determine the value of each data point. However, you can hide major gridlines for the value axis or add gridlines to the category axis by using the Axis.MajorGridlines property. You can also display minor gridlines by utilizing the Axis.MinorGridlines property.

Note

The complete sample project is available in the DevExpress-Examples/wpf-spreadsheet-chart-api-t113198 repository on GitHub.

Expanded See Also

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