Monday, May 20, 2024
172
rated 0 times [  174] [ 2]  / answers: 1 / hits: 21105  / 12 Years ago, wed, may 2, 2012, 12:00:00

I'm using Google Charts Tools, specifically the Pie Chart.



Naturally, if a item has a value of 0, it is not displayed in the pie (since it occupies 0% of the pie). However, it doesn't display in the legend either.



How can I manipulate the initialization options to still show a 0 value item in the legend, so that users can see that the item exists, it just has a 0 value?


More From » google-visualization

 Answers
29

setting sliceVisibilityThreshold as zero will solve your problem.



function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', 11],
['Eat', 0],
['Commute', 2],
['Watch TV', 2],
['Sleep', 7]
]);

// Create and draw the visualization.
new google.visualization.PieChart(document.getElementById('visualization')).
draw(data, {title:So, how was your day?,
sliceVisibilityThreshold:0
});
}


[#85835] Tuesday, May 1, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
marisela

Total Points: 103
Total Questions: 105
Total Answers: 102

Location: Solomon Islands
Member since Fri, Oct 8, 2021
3 Years ago
;