Format Property
Description
Gets/sets the format string used to format text in the label.
Property Type
Read-only property
Syntax (Visual Basic)
Public Property Format() As [ChartNumberFormat](XtremeChartControl~ChartNumberFormat.md)
Return Type
The format string used to format text in the label.
Remarks
Format strings can be used to format the text in the label. This utilizes properties from the ChartNumberFormat object to format the pattern, use a currency symbol, set decimal places, locale, etc.
The ChartNumberFormat is used to format strings for the various text labels in the chart. It is used to format the pattern, use a currency symbol, set decimal places, locale, etc.
First, you will see how to use only the Pattern to format a string. Then, you will see how to use the other properties of ChartNumberFormat to make formatting easier and much more flexible. Some things, like inserting a thousands separator, can't be done with the pattern alone; you will need to use the UseThousandSeparator property.
In the sample below, the {A} represents the ChartSeriesPoint's ArgumentValue, and the {V} represents the Value.
Style.Label.Format.Pattern = "{A} ${V}K"
Note: Pattern is the default value for this object, so in some languages, you can simply set the Format property to the desired pattern:
Style.Label.Format = "{A} ${V}K"
Other formatting is available for numbers, such as .03f, which means 3 decimal places for a floating-point number.
Style3D.Label.Format.Pattern = "%.03f M"
Here, "g" is the placeholder for standard numbers:
StylePie.Label.Format.Pattern = "%g M"
Using the ChartNumberFormat's properties makes formatting the string much easier and simplifies the pattern. For example, you don't need to set the type of data in the pattern (i.e., %g); it can be handled using the Category property. If you desire a thousands separator, you will need the UseThousandSeparator property. Decimal places are handled with the DecimalPlaces property. The Category is used to specify how to format the value (Number, Currency, Percent, Scientific, etc.). There are also properties to set the Date and Time if the value represents a Date and/or Time.
Here is a simple example that formats a number as currency:
Style.Label.Format.Pattern = "{A} {V}"
Style.Label.Format.UseThousandSeparator = True
Style.Label.Format.DecimalPlaces = 0
Style.Label.Format.Category = xtpChartCurrency
Below, the funnel's labels are using this formatting from the sample above.

Below, the funnel's labels are using only the Pattern property for formatting:
Style.Label.Format.Pattern = "{A} ${V}K"

See Also
ChartRadarPointSeriesLabel Object
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.