Need a special offer?Find out if your project fits.
+
All documentation
API reference
  • API Reference for older versions
  • FormatObject

    The FormatObject defines the way how numeric values are formatted in the component.

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

    Find more details in the Number formatting tutorial.

    Properties

    {
      name: string,
      thousandsSeparator: string,
      decimalSeparator: string,
      decimalPlaces: number,
      maxDecimalPlaces: number,
      maxSymbols: number,
      negativeNumberFormat: string,
      currencySymbol: string,
      positiveCurrencyFormat: string,
      negativeCurrencyFormat: string,
      isPercent: boolean,
      isCount: boolean,
      nullValue: string,
      infinityValue: string,
      divideByZeroValue: string,
      textAlign: string,
      beautifyFloatingPoint: boolean
    }
    Property/Type Description
    name
    String
    The name 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 number of decimal places to show after the decimal separator.
    If a number has more decimal places than required, it is rounded. If the decimal part is smaller, zeroes are added to its end. To show the entire number, set decimalPlaces to -1.
    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.
    This property is included when exporting a report to Excel.
    Default value: -1 (the entire number is shown).
    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.
    This property is included when exporting a report to Excel.
    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. Possible values: "-1", "- 1", "1-", "1 -", "(1)", "1".
    This property is included when exporting a report to Excel.
    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 this property.
    This property is included when exporting a report to Excel.
    Default value: "".
    positiveCurrencyFormat
    String
    optional The format of the currency symbol. It can be either "$1" or "1$".
    This property is included when exporting a report to Excel.
    Default value: "$1".
    negativeCurrencyFormat
    String
    optional The format of the currency symbol to display negative amounts. Possible values: "-$1", "-1$", "$-1", "$1-", "1-$", "1$-", "($1)", "(1$)", "$(1)", "(1)$", "$1", "1$".
    This property is included when exporting a report to Excel.
    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.
    This property is included when exporting a report to Excel.
    Default value: false.
    isCount
    Boolean
    optional When set to true, values are rounded to the nearest integer. Also, the currencySymbol and decimalPlaces properties are ignored.
    Default value: false.
    nullValue
    String
    optional Defines how to show null values in the grid.
    This property is included when exporting a report to Excel.
    Default value: "".
    infinityValue
    String
    optional Defines how to show infinity values in the grid.
    This property is included when exporting a report to Excel.
    Default value: "Infinity".
    divideByZeroValue
    String
    optional Defines how to show divided by zero values in the grid.
    This property is included when exporting a report to Excel.
    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".
    This property is included when exporting a report to Excel.
    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.

    See also

    Number formatting guide
    setFormat()
    getFormat()