cartercjb
01-14-2022ETL
Dynamic Decimal Points
Hello Sisense Community!
Is anyone aware of a method to dynamically round data labels so that:
Any value >= 1000.00 shows two decimal points (green in the screenshot)
Any value < 1000.00 sho...
- 01-17-2022
I think there are 2 solution :
1. You can choose automatic rounding in 'Format Number' window. It will automatically remove '.00' from values (here we cannot control number of digits after decimal point as it is deciding decimal places dynamically)
2. Here is a script for this purpose :
//Apply rounding in datalabel widget.on('processresult', function(se,ev){ ev.result.plotOptions.series.dataLabels.formatter = function(){ return this.y < 1000 ? this.y.toFixed(0) : ev.result.series[0].mask(this.y) } }) //applying rounding in tooltip widget.on('beforedatapointtooltip', function(se,ev){ if(ev.context.pointScope.y < 1000) ev.context.points[0].value = ev.context.pointScope.y.toFixed(0) })
(Note : percentage/currency symbol will not work with this script)
Thanks,
-Hari