All documentation
  • 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/TypeDescription
    name
    String
    The format’s 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 thousands in numbers.
    Note that in the exported Excel file, a separator for thousands is taken from your system's regional settings. See how to change the separator for thousands in Excel.
    Default value: " " (space).
    decimalSeparator
    String
    optional Defines the specific character used to separate decimal parts of numbers.
    Note that in the exported Excel file, a separator for decimals is taken from your system's regional settings. See how to change the separator for decimals in Excel.
    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 the 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 the decimalPlaces is set to 0.
    This property is ignored when the "count" aggregation is applied to the measure.
    The decimalPlaces is included when exporting a report to Excel. Use this property to display measures as integers in the exported Excel file.
    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 the 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. When the limit is exceeded, the number is displayed in the e-notation (e.g., 5.8e+23).
    This property works only for integers. If the number has a fractional part, the maxSymbols is ignored.
    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 ignored when the "count" aggregation is applied to the measure.
    The currencySymbol 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 The isPercent property is ignored if the currencySymbol is set to % or when the "count" aggregation is applied to the measure.
    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 on the grid.
    This property is ignored when the "count" aggregation is applied to the measure.
    This property is included when exporting a report to Excel.
    Default value: "".
    infinityValue
    String
    optional Defines how to show infinity values on the grid Live example.
    This property is included when exporting a report to Excel.
    Default value: "Infinity".
    divideByZeroValue
    String
    optional Defines how to show values divided by zero on the grid Live example.
    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 This property helps fix precision errors when doing floating point math (e.g., when .1 + .2 returns 0.30000000000000004).
    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()