Get Free Trial
API reference
Table of contents

FormatObject

The FormatObject defines the way how numeric values are formatted in the component. Find more details in the Number formatting tutorial.

The FormatObject contains the following number format parameters:

  • name – String. Should be unique as it identifies the format in the report. Note: the format with the name property set to "" defines a default number format and it is applied to all the measures without a specific number format. Default value: "".
  • thousandsSeparator – String. Default value: " " (space).
  • decimalSeparator – String. Default value: ".".
  • decimalPlaces – Number. The exact number of decimals to show after the decimal separator. When set to -1, the entire number is shown. Note that for e-notation numbers (e.g., 5.8e+23), at least one decimal is always shown after the decimal separator, even if decimalPlaces is set to 0. Default value: -1.
  • maxDecimalPlaces – Number. The maximum number of decimals to show after the decimal separator. When set to -1, the entire number is shown. Note that for e-notation numbers (e.g., 5.8e+23), at least one decimal is always shown after the decimal separator, even if maxDecimalPlaces is set to 0. Default value: -1.
  • maxSymbols – Number. The maximum number of symbols in a cell. Default value: 20.
  • negativeNumberFormat – String. The format of the negative numbers. It can be one of the following values: "-1", "- 1", "1-", "1 -", and "(1)". Default value: "-1".
  • currencySymbol – String. The symbol which is shown to the left or the right of the value (e.g. currency symbol, hours, percent, etc.). Default value: "".
  • positiveCurrencyFormat – String. The format of the currency symbol. It can be either "$1" or "1$". Default value: "$1".
  • negativeCurrencyFormat – String. The format of the currency symbol to display negative amounts. It can have the following values: "-$1", "-1$", "$-1", "$1-", "1-$", "1$-", "($1)", and "(1$)". Default value: "-$1".
  • isPercent – Boolean. When set to true, data is formatted as percentage. The behavior is the same as in Excel. Setting isPercent to true will result in numbers being multiplied by 100 and shown with a % symbol. For example, 0.56 gets changed to 56%. Note: if % is set as currencySymbol, setting isPercent to true will not multiply numbers by 100. Default value: false.
  • nullValue – String. Defines how to show null values in the grid. Default value: "".
  • infinityValue – String. Defines how to show infinity values in the grid. Default value: "Infinity".
  • divideByZeroValue – String. Defines how to show divided by zero values in the grid. Default value: "Infinity".
  • textAlign – String. The alignment of formatted values in cells on the grid. It can have the following values: "right", "left", and "center". Default value: "right".
  • beautifyFloatingPoint – Boolean. When set to true, formats numbers like 1.560000000000001 as 1.56. Setting beautifyFloatingPoint to false means that the entire number will be shown. Default value: true.

Set the FormatObject via setFormat() API call. Get this object using getFormat().

See also

Number formatting guide
setFormat()
getFormat()