getFormat(measureName: String, aggregation: String): FormatObject
[starting from version: 1.4]
Returns the default number format or the number format for the specified measure.
The number format can be defined in a report or using the setFormat() method. Each measure has only one format but a format can be applied to more than one measure. Learn more in this guide: Number formatting.
If getFormat()
is called without parameters, the default number format is returned.
To get the number format of a specific measure, specify the following parameters:
FormatObject, which is the default number format or the number format applied to the specified measure.
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.