Back to Devexpress

NumericOptions.Format Property

corelibraries-devexpress-dot-xtracharts-dot-numericoptions-b43f4972.md

latest4.4 KB
Original Source

NumericOptions.Format Property

Gets or sets a value that specifies the formatting applied to numeric values.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public NumericFormat Format { get; set; }
vb
Public Property Format As NumericFormat

Property Value

TypeDescription
NumericFormat

A NumericFormat enumeration value.

|

Available values:

NameDescription
General

Displays numbers without any specific formatting applied to them. Integer and fractional parts are separated using the decimal symbol specified in your computer’s regional settings.

Example: 100.

| | Scientific |

Displays numbers using the standard scientific notation. This format is determined by your computer’s regional settings.

Example: 1.00E+002.

| | FixedPoint |

Displays numbers as real numeric values with the specified number of digits for the fractional part. How many digits is specified by the NumericOptions.Precision property, and the decimal separator is based upon your computer’s regional settings.

Example: 100.00.

| | Currency |

Displays numbers as currency, using the currency format specified in your computer’s regional settings.

Example: $100.

| | Percent |

Displays numbers multiplied by 100 with a percent sign (%) appended to the right; displays two digits to the right of the symbol specified in your computer’s regional settings.

Example: 100 %.

| | Number |

Displays numbers as numeric values, using the number format specified in your computer’s regional settings.

Example: 100.00.

|

Remarks

Use the Format property, to define the appropriate format for numeric values representation in the axis labels, series point labels or in legend.

For example, the following image demonstrates the currency formatting applied to series points values, expressed by the $ sign added to the values.

For more information on using this property, refer to Axis Scale Types.

Example

This example demonstrates how to make series point labels of a pie chart show their values as percentages.

Note that to achieve this at runtime, you should cast the series’ SeriesBase.PointOptions to the PiePointOptions type.

csharp
// Make the series points' values to be displayed as percents.
((PiePointOptions)series1.PointOptions).PercentOptions.ValueAsPercent = true;
((PiePointOptions)series1.PointOptions).ValueNumericOptions.Format = NumericFormat.Percent;
((PiePointOptions)series1.PointOptions).ValueNumericOptions.Precision = 0;
vb
' Make the series points' values to be displayed as percents.
CType(series1.PointOptions, PiePointOptions).PercentOptions.ValueAsPercent = True
CType(series1.PointOptions, PiePointOptions).ValueNumericOptions.Format = NumericFormat.Percent
CType(series1.PointOptions, PiePointOptions).ValueNumericOptions.Precision = 0

See Also

Axis Scale Types

NumericOptions Class

NumericOptions Members

DevExpress.XtraCharts Namespace