top of page

Display values in legend - Pie chart

The script below displays value of each items along with legend


  1. Create a pie chart

  2. Add below script to widget

  3. Save the script and refresh widget

widget.on('processresult', function(se, ev){
	ev.result.legend.labelFormatter = function(){
		legendData = ev.result.series[0].data.find(el=> ==
		myItem = se.metadata.panels[1].items[0]
		myMask = $$get(myItem, "format.mask", {})

		var numberFormatter = prism.$injector.get('$filter')('numeric');
		formattesValue = numberFormatter(legendData, myMask);
		return + '<span style="color:#838584; font-size:12.5px"> <b> (' + formattesValue + ')</b></span>'

199 views1 comment

Recent Posts

See All

1 Comment

Can I use this to remove a series label from a legend? The other solution posted doesn't work for pie charts.

bottom of page