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.

Available properties

The FormatObject contains the following number format parameters:

Property/Type Description
name
String
It 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
optional Defines the specific character used to separate groups of digits in numbers.
Default value: " " (space).
decimalSeparator
String
optional Defines the specific character used to separate decimal parts of numbers.
Default value: ".".
decimalPlaces
Number
optional 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
optional 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
optional The maximum number of symbols in a cell.
Default value: 20.
negativeNumberFormat
String
optional 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
optional The symbol which is shown to the left or the right of the value (e.g. currency symbol, hours, percent, etc.). Learn more about the ways to set the property.
Default value: "".
positiveCurrencyFormat
String
optional The format of the currency symbol. It can be either "$1" or "1$".
Default value: "$1".
negativeCurrencyFormat
String
optional The format of the currency symbol to display negative amounts. It can be one of the following values: "-$1", "-1$", "$-1", "$1-", "1-$", "1$-", "($1)", and "(1$)".
Default value: "-$1".
isPercent
Boolean
optional When set to true, data is formatted as a 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
optional Defines how to show null values in the grid.
Default value: "".
infinityValue
String
optional Defines how to show infinity values in the grid.
Default value: "Infinity".
divideByZeroValue
String
optional Defines how to show divided by zero values in the grid.
Default value: "Infinity".
textAlign
String
optional 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
optional In JavaScript the output of console.log(.1 + .2); is 0.30000000000000004. Check https://0.30000000000000004.com for more details about the problem. When the beautifyFloatingPoint property is set to true, numbers such as 0.30000000000000004 are formatted as 0.3. Setting beautifyFloatingPoint to false means that the full 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()