NumericOptions.Format Property
Gets or sets a value that specifies the formatting applied to numeric values.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.2.dll
NuGet Package: DevExpress.Charts
#Declaration
public NumericFormat Format { get; set; }
#Property Value
Type | Description |
---|---|
Numeric |
A Numeric |
Available values:
Name | Description |
---|---|
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. |
Fixed |
Displays numbers as real numeric values with the specified number of digits for the fractional part. How many digits is specified by the Numeric Example: 100. |
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. |
#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.
// 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;