Skip to main content
A newer version of this page is available. .

AxisCollection Interface

A collection that stores axes in the chart.

Namespace: DevExpress.Spreadsheet.Charts

Assembly: DevExpress.Spreadsheet.v18.2.Core.dll

Declaration

public interface AxisCollection :
    ISimpleCollection<Axis>,
    IEnumerable<Axis>,
    IEnumerable,
    ICollection

The following members return AxisCollection objects:

Remarks

The AxisCollection is generated automatically when creating a chart and depends on the chart type. Most charts have two primary axes: the category axis (X-axis) and the value axis (Y-axis). 3-D charts also have the depth (or series) axis along which the series names are displayed. The bubble and scatter charts have two value axis, while the pie and doughnut charts have no axes at all.

To access a collection of primary axes, use the ChartObject.PrimaryAxes property. You can get an individual axis defined by the Axis object by its index in the collection. The category axis is the first item in the axis collection with the index 0, the value axis is the second item with the index 1, and the series axis (if it is presented) is the third item with the index 2.

A chart may also have a collection of secondary axes accessible via the ChartObject.SecondaryAxes property. This collection includes two items: the secondary category axis with the index 0 and the secondary value axis with index 1. To display secondary axes for a specific series, set the Series.AxisGroup property to the AxisGroup.Secondary value.

Example

The following example demonstrates how to create a clustered column chart and display numbers on the value axis as percentage values. To apply the number format, set the NumberFormatOptions.IsSourceLinked property to false and assign the corresponding format code to the NumberFormatOptions.FormatCode property.

Dim worksheet As Worksheet = workbook.Worksheets("chartTask3")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet("B3:C5"))
chart.TopLeftCell = worksheet.Cells("H2")
chart.BottomRightCell = worksheet.Cells("N14")

' Format the axis labels.
Dim axis As Axis = chart.PrimaryAxes(1)
axis.NumberFormat.FormatCode = "0%"
axis.NumberFormat.IsSourceLinked = False

' Hide the legend.
chart.Legend.Visible = False
See Also