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

    getFormat(measureName: String, aggregation: String): FormatObject

    [starting from version: 1.4]

    Returns the number format of the specified measure or the default format if run without parameters.

    Learn more about number formatting.

    Parameters

    Parameter/Type Description
    measureName
    String
    optional The measure's unique name. Must be used with the aggregation parameter unless the measure is calculated.
    To get the default format, skip the measureName.
    aggregation
    String
    optional The measure’s aggregation. Must be used with the measureName.
    If the measure is calculated, skip the aggregation.

    Returns

    FormatObject, which is the default number format or the number format applied to the specified measure.

    Examples

    1) How to get a precision of the default number format:

    let format = flexmonster.getFormat();
    alert("Precision: " + format.decimalPlaces);

    Try on JSFiddle.

    2) How to change a currency symbol for a specific measure:

    let format = flexmonster.getFormat("Price", "sum");
    format.currencySymbol = "$";
    //format.currencySymbol = "£" // pound sterling
    //format.currencySymbol = "€" // euro
    //format.currencySymbol = "¥" // yen
    flexmonster.setFormat(format, "Price", "sum");
    flexmonster.refresh();

    Open the example on JSFiddle.

    See also

    setFormat
    FormatObject
    Number formatting guide