reju
reju

Reputation: 63

How to show all legends in google Visualization: Pie Chart

i am using Google visualization pie chart for showing my vote details.But the chart didn't showing the zero values and legends. How to show all legends in Google Visualization: Pie Chart

Upvotes: 3

Views: 9908

Answers (2)

bububaba
bububaba

Reputation: 2870

You can simply set the sliceVisibilityThreshold option to 0. This will force all the legends to show.

var options = {
    sliceVisibilityThreshold: 0
};
var data = /* ... */;

var chart = new google.visualization.PieChart(/* ... */);
chart.draw(data, options);

Upvotes: 14

BIScuit
BIScuit

Reputation: 11

What I did was to add a small value (0.005) to each of the values. When setting the sliceVisibilityThreshold: 1/25000, (1/25000 = 0.004) the slice/legend will be shown but the value will still be 0% due to rounding.

Upvotes: 1

Related Questions