Help - Decimal format
Decimal formats can be applied to any text element such as nodes, text labels or legends. The decimal format of a scale bar also affects its scale labels. You can change the decimal formats using the element formats-dialog.
A decimal format pattern comprises of a prefix, number formats and a suffix. The prefix and suffix are optional and allow you to display any character sequence in front and behind the formated decimal value. This could e.g. be brackets using a pattern like "
[0.00]". The number format itself can consist of a combination of the following special symbols which stand for special characters like the localized decimal separator or a part of the value (e.g. "
0" or "
#"). All symbols listed below must be masked with "
'" if they shall be displayed in the prefix or suffix (see table for details).
||Number||Digit. If this symbol is used behind the decimal separator a zero will be displayed if the value does not contain any more decimal places. (See examples below.)|
||Number||Digit. If this symbol is used behind the decimal separator nothing will be displayed if the value does not contain any more decimal places. (See examples below.)|
||Number||Minus sign. Only useful in the negative subpattern (see below).|
||Number||Grouping separator (e.g. for thousands)|
||Number||Separates mantissa and exponent in scientific notation. (Needs not be quoted in prefix or suffix.)|
||Prefix or suffix||Value is multiplied by 100 and shown as percentage.|
||Prefix or suffix||Used to quote special characters in a prefix or suffix, for example, "
The grouping separator is commonly used for thousands, but in some countries it separates ten-thousands. The grouping size is a constant number of digits between the grouping characters, such as 3 for 100,000,000 or 4 for 1,0000,0000. If you supply a pattern with multiple grouping characters, the interval between the last one and the end of the integer is the one that is used. (The formats "
##,####,####" and "
#,##,###,####" will lead to the same result where the last example is not really a sense making format.)
Additionally a decimal format pattern can be composed of a positive and negative subpattern which are separated by a "
;" if you want to display positive and negative values differently. The negative subpattern is optional. If absent the positive subpattern prefixed with the localized minus sign ('-' in most locales) is used as the negative subpattern. (i.e. "
0.00" is equivalent to "
0.00;-0.00" but not to e.g. "
0.00;[-0.00]") Negative subpatterns serve only to specify the negative prefix and suffix. The number of digits, minimal digits, and other characteristics are all the same as the positive pattern. That means that "
#,##0.0#;(#)" produces precisely the same behavior as "
You can specify the locale here which influences e.g. the decimal separator which is used to display the value in the document. (Note that this does not influence the syntax where the decimal separator is always "
.") When you create an XTG file where a certain locale is used you have to be aware that you can only display this file correctly on systems where this locale is available.
The following table shows how example values would be displayed with different formats and locales.
|Positive value||Format||Locale||Positive example||Negative example|
You can try out your format using the preview field on the bottom of the decimal formats-tab in the element formats-dialog.