harikm007
06-06-2022Data Warehouse
Display total value in legend
The script below displays value of each items along with legend in pie chart.
Refer : https://www.binextlevel.com/post/display-values-in-legend-pie-chart
widget.on('processresult', function(se, ev){
ev.result.legend.labelFormatter = function(){
console.log(this)
legendData = ev.result.series[0].data.find(el=>el.name == this.name).y
myItem = se.metadata.panels[1].items[0]
myMask = $$get(myItem, "format.mask", {})
var numberFormatter = prism.$injector.get('$filter')('numeric');
formattesValue = numberFormatter(legendData, myMask);
return this.name + '<span style="color:#838584; font-size:12.5px"> <b> (' + formattesValue + ')</b></span>'
}
})
Refer below link to find script for Bar/Column/Line/Area charts
Display total value in legend - Bar/Column/Area/Line chart
-Hari