I am working with Google Pie Charts API in Javascript. I am using Javascript within PHP. I am passing array elements to API url. But, somehow, I am not getting the required Pie Chart. I think I am messing with the syntax of passing variables to the API url.
This is the code I am using:
function pie(){
?>
<SCRIPT LANGUAGE='Javascript'><!--
piechart();
function piechart() {
var chtdata = new Array(50,50,100,25); // Array containing values to be mapped
var doc1 = "<img src='http://chart.apis.google.com/chart?cht=p3&chs=450x200&chd=t:'+chtdata[0]+',50,100,20&chl='r'|'s'|'g'|'h'&chtt='Visitor Details'&chco=ff0000' name='piechart' />";
document.write(doc1);
document.write('Done.');
}
</SCRIPT>
<?php
It would be great if you could point out my mistake. Any help will be appreciated.