Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts Pie Chart Label Threshold

Tags:

highcharts

Is there a preferred way to eliminate or aggregate labels below a certain threshold when using HighCharts pie chart? I'd rather not have to rollup all values below a certain percentage into 'other' if I can. I've checked the docs and can't find anything. It would be very useful!

Thanks in anticipation.

like image 745
Mat E. Avatar asked Aug 28 '11 21:08

Mat E.


1 Answers

The best way to achieve this is to use dataLabels formatter for pie chart like this:

plotOptions: {
    pie: {
        dataLabels: {
            formatter: function(){
                if (this.percentage < SOME_VALUE) return "";

                return VALUE_TO_SHOW;
            }
        }
    }
}

Replace SOME_VALUE and VALUE_TOSHOW with desired values. But there will be some problems if you're using connector for you labels (it is always visible).

like image 53
Igor Dymov Avatar answered Sep 20 '22 19:09

Igor Dymov