admin管理员组

文章数量:1026683

There is always thin sector for 0 (0%) value. How can I hide zero value sector on a pie chart. /

data: [
        ['Firefox',   100.0],
        ['Others',   0]
      ]

Remove this white line
(source: piccy.info)

There is always thin sector for 0 (0%) value. How can I hide zero value sector on a pie chart. http://jsfiddle/t0hgLx2n/

data: [
        ['Firefox',   100.0],
        ['Others',   0]
      ]

Remove this white line
(source: piccy.info)

Share Improve this question edited Sep 25, 2019 at 15:04 Glorfindel 22.7k13 gold badges90 silver badges120 bronze badges asked Feb 3, 2015 at 14:42 iyeliyel 1351 gold badge4 silver badges10 bronze badges 5
  • Is using { name: 'Others', y: 0, visible: false } in the data-array considered a solution? Might require some more information on why it cannot just be removed from the data-array, or set to not visible upon creation, if these are not acceptable. – Halvor Holsten Strand Commented Feb 3, 2015 at 15:03
  • Your suggestion doesn't work either jsfiddle/4yjn0g5h – iyel Commented Feb 3, 2015 at 16:21
  • How does it "not work"? It doesn't show on the pie. What criteria must be met to work? – Halvor Holsten Strand Commented Feb 3, 2015 at 16:39
  • Is it the legend item you wish to remove on the picture (where the text "Others" is)? – Halvor Holsten Strand Commented Feb 3, 2015 at 21:56
  • legend item and white space – iyel Commented Feb 4, 2015 at 9:36
Add a ment  | 

2 Answers 2

Reset to default 6

This question could be resolved by two parts:

  1. filter zero data

        data: [
            ['Firefox',   100.0],
            ['Others',   0]
        ].filter(function(d) {return d[1] > 0})
    
  2. remove border in one-slice pie

    (please refer to Border in one-slice pie #1828)


http://jsfiddle/Joe_Wu/sub2houn/


It's been a while but if anyone stumbles upon this you have to update Highcharts to at least version 5.

Example

Replace:

<script src="http://code.highcharts./4.0/highcharts.js"></script>

With:

<script src="http://code.highcharts./6.0/highcharts.js"></script>

There is always thin sector for 0 (0%) value. How can I hide zero value sector on a pie chart. /

data: [
        ['Firefox',   100.0],
        ['Others',   0]
      ]

Remove this white line
(source: piccy.info)

There is always thin sector for 0 (0%) value. How can I hide zero value sector on a pie chart. http://jsfiddle/t0hgLx2n/

data: [
        ['Firefox',   100.0],
        ['Others',   0]
      ]

Remove this white line
(source: piccy.info)

Share Improve this question edited Sep 25, 2019 at 15:04 Glorfindel 22.7k13 gold badges90 silver badges120 bronze badges asked Feb 3, 2015 at 14:42 iyeliyel 1351 gold badge4 silver badges10 bronze badges 5
  • Is using { name: 'Others', y: 0, visible: false } in the data-array considered a solution? Might require some more information on why it cannot just be removed from the data-array, or set to not visible upon creation, if these are not acceptable. – Halvor Holsten Strand Commented Feb 3, 2015 at 15:03
  • Your suggestion doesn't work either jsfiddle/4yjn0g5h – iyel Commented Feb 3, 2015 at 16:21
  • How does it "not work"? It doesn't show on the pie. What criteria must be met to work? – Halvor Holsten Strand Commented Feb 3, 2015 at 16:39
  • Is it the legend item you wish to remove on the picture (where the text "Others" is)? – Halvor Holsten Strand Commented Feb 3, 2015 at 21:56
  • legend item and white space – iyel Commented Feb 4, 2015 at 9:36
Add a ment  | 

2 Answers 2

Reset to default 6

This question could be resolved by two parts:

  1. filter zero data

        data: [
            ['Firefox',   100.0],
            ['Others',   0]
        ].filter(function(d) {return d[1] > 0})
    
  2. remove border in one-slice pie

    (please refer to Border in one-slice pie #1828)


http://jsfiddle/Joe_Wu/sub2houn/


It's been a while but if anyone stumbles upon this you have to update Highcharts to at least version 5.

Example

Replace:

<script src="http://code.highcharts./4.0/highcharts.js"></script>

With:

<script src="http://code.highcharts./6.0/highcharts.js"></script>

本文标签: javascriptHighcharts pie chart hide zero sectorStack Overflow