Chart widget axis label formatting
The Widget Editor supports formatting codes to define the format of axis labels. The code-entry field allows custom formatting codes.
See more information about the available label formatting codes and how to apply them at the AG Charts Axis Labels page here: https://charts.ag-grid.com/vue/axes-labels/#number-formatting.
For number axes, a format string can be provided, which formats the numbers for display as axis labels. The format string may contain the following directives:
[[fill]align][sign][#][0][width][grouping_option][.precision][type]
Where:
-
fill- Can be any character. -
align:-
>- Forces the field to be right-aligned within the available space (default). -
<- Forces the field to be left-aligned within the available space. -
^- Forces the field to be centered within the available space. -
=- Like >, but with any sign and symbol to the left of any padding.
-
-
sign:-
-- Nothing for zero or positive and a minus sign for negative (default). -
+- A plus sign for zero or positive and a minus sign for negative. -
(- Nothing for zero or positive and parentheses for negative. -
<empty space>- A space for zero or positive and a minus sign for negative.
-
-
symbol:-
$- Apply the $ currency symbol -
#- For binary, octal, or hexadecimal notation, prefix by 0b, 0o, or 0x, respectively.
-
-
zero- The 0 option enables zero-padding. Implicitly sets fill to 0 and align to =. -
width- The width defines the minimum field width. If not specified, then the width will be determined by the content. -
comma- The comma , option enables the use of a group separator, such as a comma for thousands. -
precision- Depending on the type, the precision either indicates the number of digits that follow the decimal point (types f and %), or the number of significant digits (types , e, g, r, s and p). If the precision is not specified, it defaults to 6 for all types except (none), which defaults to 12. Precision is ignored for integer formats (types b, o, d, x, X and c). -
trim- The ~ option trims insignificant trailing zeros across all format types. This is most commonly used in conjunction with types r, e, s and %. -
type- Determines how the data should be presented:-
%- Multiply by 100, and then decimal notation with a percent sign. -
b- Binary notation, rounded to integer. -
c- Converts the integer to the corresponding unicode character before printing. -
d- Decimal notation, rounded to integer. -
e- Exponent notation. -
f- Fixed point notation. -
g- Either decimal or exponent notation, rounded to significant digits. -
o- Octal notation, rounded to integer. -
p- Multiply by 100, round to significant digits, and then decimal notation with a percent sign. -
r- Decimal notation, rounded to significant digits. -
s- Decimal notation with a SI prefix, rounded to significant digits. -
x- Hexadecimal notation, using lower-case letters, rounded to integer. -
X- Hexadecimal notation, using upper-case letters, rounded to integer.
-