cancel
Showing results for 
Search instead for 
Did you mean: 

Bar Chart - Add Percentage to the Value Label

Ophir_Buchman
Sisense Team Member
Sisense Team Member

When creating a column chart you might want to add a percentage value next to the actual value

Add the following script to your widget:

widget.on('processresult', function(widget,result) { 
result.result.plotOptions.series.dataLabels.formatter = function() {
total = 0
this.series.data.forEach(function(datapoint) { total += datapoint.y })

percent = (100 * this.y) / (total);
percent = percent.toFixed(1);

return this.y + '<br/>(' + percent + '%)'
}
})
Before After
Ophir_Buchman_0-1650452574643.png Ophir_Buchman_1-1650452595480.png
0 REPLIES 0
Voice of Customer
Impact Business Intelligence (BI) and Analytics Market Research

Click Here & Complete Dresner's Wisdom of Crowds® Market Study Survey Today!

Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Need additional support?:

Community Support Request

Don't miss out:

Earn a BETA Launch Challenge Badge!