Home › forums › Using CanvasJS › Pie chart index label for 0
Tagged: pie chart
This topic contains 4 replies, has 2 voices, and was last updated by Navinder 1 year, 11 months ago.
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?
You can use indexLabelFormatter to achieve this. Please check this jsfiddle.
But this one displays exact y value rather than percentage.
I think (indexLabel: “#percent%”) is overridden by indexLabelFormatter.
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.
I have been able to achieve it with the help of e.total.
Thanks for your help.
You must be logged in to reply to this topic.