/ Published in: PHP
Used to make a Google Pie Chart, with optional labels and size from an array, using the array keys as the labels and the values for the data.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function googleChart($statsArray, $w = 300, $h = 175, $return = 'URL', $labels = true) { // Start the Google charts URL $gChartURL = "http://chart.apis.google.com/chart?cht=p&chd=t:"; // Append our values // Optionally return our labels if($labels) { } // Set our chart size $gChartURL .= "&chs={$w}x{$h}"; { return $gChartURL; } { return "<img src=\"{$gChartURL}\" width={$w} height={$h} />"; } }