cancel
Showing results for 
Search instead for 
Did you mean: 

Display total value in legend

harikm007
12 - Data Integration
12 - Data Integration

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

harikm007_1-1654539575225.png

 

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

harikm007_0-1654539233146.png

 

-Hari

 

0 REPLIES 0