.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

DataLabelBase.NumberFormat Property

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

Namespace: DevExpress.Spreadsheet.Charts

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


NumberFormatOptions NumberFormat { get; }

Property Value

Type Description

A NumberFormatOptions object that contains formatting options for displaying numbers.


You can specify how to display numeric values in data labels by applying number formats. For example, a number in the data label can appear as a percentage, decimal, currency, accounting, date or time value. To apply a number format to data 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.


The example below demonstrates how to create a clustered column chart and format numeric values displayed in data labels 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("B2:D4"))
chart.TopLeftCell = worksheet.Cells("H2")
chart.BottomRightCell = worksheet.Cells("N14")

' Display data labels and specify their position within the chart.
chart.Views(0).DataLabels.ShowValue = True
chart.Views(0).DataLabels.LabelPosition = DataLabelPosition.Center

' Format data labels.
chart.Views(0).DataLabels.NumberFormat.FormatCode = "0%"
chart.Views(0).DataLabels.NumberFormat.IsSourceLinked = False
See Also