Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

Axis.NumberFormat Property

Provides access to number format options for numerical values displayed in axis labels.

Namespace: DevExpress.Spreadsheet.Charts

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

Declaration

NumberFormatOptions NumberFormat { get; }

Property Value

Type Description
NumberFormatOptions

A NumberFormatOptions object that contains formatting options for displaying numbers.

Remarks

You can specify how to display numeric values on the axis by applying number formats. For example, a number in the axis label can appear as a percentage, decimal, currency, accounting, date or time value. To apply a number format to axis labels, assign the corresponding number format code to the NumberFormatOptions.FormatCode property. This property takes effect only when the NumberFormatOptions.IsSourceLinked property, which allows you to keep the number format linked to the worksheet cell, is set to false.

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