Percentage in pie legend
Lots of pie charts have the percentage value next to the name in the legend. Today you can only get the name and y-value in the legend's labelFormatter. It would be really great if you could add percentage as well, like the tooltip's formatter.
![](https://secure.gravatar.com/avatar/5e460d771fdaa2074831bada4c61082e?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
Completed: http://jsfiddle.net/highcharts/9wXvr/
-
Anonymous commented
You can use next labelFormatter function
function () {
var total = 0, percentage;
$.each(this.series.data, function() {
total+=this.y;
});
percentage=((this.y/total)*100).toFixed(2);
return '<span style="color:'+this.color+'">'+percentage+'</span>'+ this.name;
}