google-visualization

Pie Chart showing "other" when it should show data


I have implemented Google Pie Chart. All works perfectly but when i try to add data less than 10 it do not plot on chart instead of that it add a new entry under legend named - "Other"

My Script is

<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
 ['Task', 'Age Difference'],
['>10',        15],
['10-15',      <?php echo $agecnt2;?>],
['16-20',      <?php echo $agecnt3;?>],
['21-25',      <?php echo $agecnt4;?>],
['26-30',      <?php echo $agecnt5;?>],
['31-35',      <?php echo $agecnt6;?>],
['36-40',      <?php echo $agecnt7;?>],
['41-45',      <?php echo $agecnt8;?>],
['46-50',      <?php echo $agecnt9;?>],
['51-55',      <?php echo $agecnt10;?>],
['56-60',      <?php echo $agecnt11;?>],
['61-65',      <?php echo $agecnt12;?>],
['66-70',      <?php echo $agecnt13;?>],
['71-75',      <?php echo $agecnt14;?>],
['76-80',      <?php echo $agecnt15;?>],
['>80',        <?php echo $agecnt16;?>]
]);

var options = {
  title: 'Age Difference'
};

var chart = new google.visualization.PieChart(document.getElementById('chart_div4'));
chart.draw(data, options);
}
</script>  

Solution

  • The Google Pie chart groups all "small" slices into an "Other" group. As a default, any group that would have a default smaller than 1/2degree is grouped into the "Other" section. You can modify the sliceVisibilityThreshold (described here) to minimize/eliminate this effect.