When working with the pie chart in Google Charts it seems to ignore items with a value of zero. I would really like to get these items to show up in the legend even though their value is zero so that the users knows that it was a possible answer to the question. Is there a way to have a zero value item still show up in the legend?
8
votes
1 Answers
15
votes
Setting the slice visibility threshold to 0 solved it for me. Notice the last option sliceVisibilityThreshold
.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, {
title:'How Much Pizza I Ate Last Night',
width:400,
height:300,
sliceVisibilityThreshold:0
});
(taken from the sample pie chart).
By default, the threshold is set to 1/720, which means (from the docs):
The slice relative part, below which a slice will not show individually. All slices that have not passed this threshold will be combined to a single slice, whose size is the sum of all their sizes. Default is not to show individually any slice which is smaller than half a degree.