tntate786
Posts: 1
Joined: Fri Aug 07, 2015 3:13 pm

Hide data label if it is zero

Is there a way to automatically hide a data label if it is zero?

I am using a column chart.

(new here not sure what information I should post along with my question)
Abspirit
Posts: 48
Joined: Wed Apr 06, 2011 11:48 am

Re: Hide data label if it is zero

Use the "formatter" in plotOptions to do that :

Code: Select all

plotOptions: {
            column: {
                dataLabels: {
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'black',
                    formatter: function(){
                    return (this.y!=0)?this.y:"";
                    }
                }
            }
        }
Example here

http://jsfiddle.net/n560bebm/

Return to “Highcharts Usage”