Numbers
Input Numbers
Decimal numbers can be represented by a decimal point or decimal comma. Numbers can also be entered in scientific notation (E-notation). For example:
Entering numbers with thousands separators is not permitted. For example:
ChartData(1,234.56 12.345,67) /* Error. */
Missing values in ChartData() can be indicated by a NULL. For example:
ChartData(12 98.3 null 8 Null NULL 7.23 -0.67)
Output Numbers
Format specifiers are to be placed between vertical bars | ... |. Leading and trailing texts can be attached as an option. The general structure is:
"[string] | [+!] [power] specifier precision | [string]" ( Optional components in square brackets [ ... ] )
The following xmCHART functions support texts with number format specifiers:
For example:
LabelTexts(all;"Amount:\n|i0|")
AxisMajorTickLabelTexts(x;"|f1|")
AxisMajorTickLabelTexts(y;"|-6f2| Mill $")
On pie charts, tree maps and stacked charts such as bar charts, area charts and histograms it is also possible to represent both absolute values (default) and percentage values. This can be done by specifying two format specifiers. The first specifier defines the format of the absolute values; the second format specifier serves to format the percentage values. If only the percentage values are to be represented, the output of the absolute values has to be suppressed by an empty format specifier ||. For example:
LabelTexts(1;"|u|\n(|f1|%)") /* Absolute and percentage values. */
LabelTexts(1;"|||f1|%") /* Percentage values only. */
The decimal point character can be changed with the function SetDecimalPoint(). A thousands separator can be inserted with the function SetThousandsSep(). SetDecimalPoint() and SetThousandsSep() are global functions, i.e. all decimal numbers displayed in a chart are concerned, regardless of whether they have to do with axis labels, chart values, etc. and also regardless of possible format specifiers.
Component | Constant | Notes |
---|---|---|
Specifiers | u | Default format. (max. 6 digits) |
i | Integer format. | |
f | Floating point format. | |
e/E | Scientific notation. | |
g/G | Scientific notation is used if the exponent is less than -4 or greater than or equal to the precision; otherwise f-format is used. | |
h/H | Engineering notation. (Engineering notation shows all exponents in multiples of three). | |
precision | 0..9 | Required, except for u-format. |
+ | + | Optional. Number always displayed with a sign. |
! | ! | Optional. Display absolute value of a number. |
power | -9..9 | Optional. Multiply number by 10th power. |
Example | Format | Result |
---|---|---|
1234.5678 | "|u|" | 1234.57 |
"|f5|" | 1234.56780 | |
"|f4|" | 1234.5678 | |
"|f3|" | 1234.568 | |
"|f2|" | 1234.57 | |
"|f1|" | 1234.6 | |
"|f0|" | 1235. | |
"|i0|" | 1235 | |
"|i1|" | 1230 | |
"|i2|" | 1200 | |
"|i3|" | 1000 | |
"|i4|" | 0 | |
"|2f1|" | 123456.8 | |
"|-2f3|" | 12.346 | |
"|+f1|" | +1234.6 | |
"|+-2f1|" | +12.3 | |
"|e2|" | 1.23e+03 | |
"|E5|" | 1.23457E+03 | |
"|+1E3|" | +1.235E+04 | |
12345.678 | "|+h1|" | +12.3e+03 |
"|+H2|" | +12.35E+03 | |
0.00000012345678 | "|g4|" | 0.1235e-06 |
0.00012345678 | "|g6|" | 0.000123 |
0.12345 | "|2f1|%" | 12.3% |
1234567.89 | "|-6f2| Mill $" | 1.23 Mill $ |
12.3456 | "(|+f2|)" | (+12.35) |
-12.3456 | "(|!f2|)" | (12.35) |