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>
A chart is used when you need to communicate complex information to show patterns and trends. Pie charts can quickly explain relative proportions of time or resource usage. Bar charts show distributions of results.
Well, it looks like the other data is Code 85, Code 15, Inbound Scan, RLTO, IDST, and No Scan at Parent hub.... Those are all being included in your pie chart. You need to adjust the data reference of the chart. Going for Guru!
If you have complicated data that needs to be simplified and presented in a way that shows a pattern or trend, a chart should always be used. They can be used to show the following:
If in doubt, always use a chart rather than a table. Our minds tend to receive information more quickly with a chart. Charts can be overused. Pick out the key information and use the most appropriate chart. There is a tendency to fill our presentations with too many pie charts, which can distract from the vital information in your presentation.
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.
For me the problem was that my php code was still a string because of echo. So i did this:
parseInt("<?php echo $phpvalue; ?>")
and it worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With