开发者

How to show all legends in google Visualization: Pie Chart

开发者 https://www.devze.com 2023-03-29 15:57 出处:网络
i am using Google visualization pie chart for showing my vote details.But the chart didn\'t showing the zero values and legends.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消