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 legend开发者_如何学运维s in Google Visualization: Pie Chart
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);
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.
精彩评论