Versa Asset
Posts: 8
Joined: Wed Jul 17, 2019 9:39 pm

How do I Hide values that are 0 in my pie chart

Thu Jul 18, 2019 7:50 pm

Hello,
I'm creating a pie chart that have a lot of data series ( 31 more or less ), but depending of the day the value of some data series will be 0, and i wanted to hide every value that appear 0 on chart. Remembering, each day will change the data serie that will be 0, so i need a comand that when one data serie will be 0, it don't appear on my pie chart
Thanks,

rafalS
Posts: 2660
Joined: Thu Jun 14, 2018 11:40 am

Re: How do I Hide values that are 0 in my pie chart

Fri Jul 19, 2019 8:28 am

Hi again,

When you create a Pie chart with 0 value, this 0 point is hidden by default. I don't quite understand you again ;) could you explain more precisely or provide a draw of what you want to achieve?

Best regards!
Rafal Sebestjanski,
Highcharts Team Lead

Versa Asset
Posts: 8
Joined: Wed Jul 17, 2019 9:39 pm

Re: How do I Hide values that are 0 in my pie chart

Fri Jul 19, 2019 4:35 pm

Look in the chart that I post. Look how many names with number 0 appear, I want to remove it and put only that ones who really have a % and not the 0 one
HighCharts.JPG
HighCharts.JPG (56.83 KiB) Viewed 9441 times

Thanks for return,
Bye

rafalS
Posts: 2660
Joined: Thu Jun 14, 2018 11:40 am

Re: How do I Hide values that are 0 in my pie chart

Mon Jul 22, 2019 11:34 am

Hi,

Go to Customize -> Custom Code, delete the actual content and paste this code:

Code: Select all

Highcharts.merge(true, options, {
  plotOptions: {
    pie: {
      dataLabels: {
        formatter: function() {
          if (this.y > 0) {
            return this.point.name + ': ' + Highcharts.numberFormat(this.point.percentage, 1) + ' %'
          }
        }
      }
    }
  }
});

Let me know if it worked.

Best regards!
Rafal Sebestjanski,
Highcharts Team Lead

Return to “Highcharts Cloud”