Highcharts Pie Chart Label Threshold

Is there a preferred way to eliminate or aggregate labels below a certain threshold when using the HighCharts pie chart? I would prefer not to collapse all values ​​below a certain percentage to "others" if possible. I checked the documents and found nothing. That would be very helpful!

Thanks pending.

+5
source share
2 answers

The best way to achieve this is to use the dataLabels formatting for the pie chart as follows:

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

                return VALUE_TO_SHOW;
            }
        }
    }
}

Replace SOME_VALUEand VALUE_TOSHOWat the desired values. But there will be problems if you use the connector for shortcuts (it is always visible).

+5
source

:

, , null, - , , :

: jsfiddle

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

                return VALUE_TO_SHOW;
            }
        }
    }
}
+1

All Articles