Home forums Using CanvasJS Pie chart index label for 0

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by  Navinder 2 months, 4 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #12411

    Navinder
    Member

    Hi,

    I am using pie chart. For partitions where data is 0, it shows 0%. Can we hide 0% where data is 0 and only show ones which have data?

    Thanks

    #12466

    Vishwas R
    Keymaster

    Navinder,

    You can use indexLabelFormatter to achieve this. Please check this jsfiddle.

    #12469

    Navinder
    Member

    Hi Vishwas,

    But this one displays exact y value rather than percentage.

    I think (indexLabel: “#percent%”) is overridden by indexLabelFormatter.

    • This reply was modified 2 months, 4 weeks ago by  Navinder.
    #12471

    Vishwas R
    Keymaster

    Navinder,

    Please refer to indexLabelFormatter documentation. You can use dataSeries, datapoint, index, total, percent, chart within indexLabelFormatter function. So when y-value is not 0, returning e.percent will fulfill your requirement. Here is the updated jsfiddle.

    #12472

    Navinder
    Member

    I have been able to achieve it with the help of e.total.

    Thanks for your help.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.