Hi,
I am using the following code to display charts using Gooogle
Visualization API. it was working and able to see the charts on the
UI . And now i am not able to see the charts, just a blank screen and
showing a javascript error message like 'Google is Undefined'.
please can somebody help me out in this.
thanks in advance.... :)
<html xmlns="
http://www.w3.org/1999/xhtml">
<head >
<title></title>
<script type="text/javascript" src="
http://www.google.com/jsapi">
function graph1(GraphType)
{
debugger;
var divid="chart_div";
var Notstarted=1;
var completed=2;
var Inprogress=3;
var sttitle="sttitle";
if(GraphType==1)
{
//google.setOnLoadCallback(drawChart);
drawChart(divid,Notstarted,completed,Inprogress,sttitle);
}
else
{
drawVisualization(divid,Notstarted,completed,Inprogress,sttitle);
}
}
function graph2(GraphType)
{
debugger;
var Notstarted=3;
var completed=2;
var Inprogress=4;
var divid2="visualization";
var sttitle="sttitle2";
if(GraphType==1)
{
drawChart(divid2,Notstarted,completed,Inprogress,sttitle);
}
else
{
drawVisualization(divid2,Notstarted,completed,Inprogress,sttitle);
}
}
function drawChart(divid, Notstarted, completed, Inprogress, sttitle)
{
var data = new google.visualization.DataTable();
data.addColumn('string', 'Task');
data.addColumn('number', 'Hours per Day');
data.addRows(5);
data.setValue(0, 0, 'Not started');
data.setValue(0, 1, Notstarted);
data.setValue(1, 0, 'In progress');
data.setValue(1, 1, Inprogress);
data.setValue(2, 0, 'Completed');
data.setValue(2, 1, completed);
var chart = new
google.visualization.PieChart(document.getElementById(divid));
chart.draw(data, { title: sttitle, legend: 'bottom' });
}
function
drawVisualization(divid2,Notstarted,completed,Inprogress,sttitle) {
var wrapper = new google.visualization.ChartWrapper({
chartType: 'ColumnChart',
dataTable: [['Not started', 'In progress',
'Completed'],
[Notstarted, Inprogress, completed]],
options: {'title': sttitle,'legend': 'bottom'},
containerId: divid2
});
wrapper.draw();
}
</script>
</head>
<body onload="graph1(1);graph2(2);" >
<table>
<tr>
<td><div id="chart_div" style="width: 300; height: 300;" >Loading
graph1...</div></td>
<td><div id="visualization" style="width: 300; height: 300;">Loading
graph2...</div></td>
</tr>
</table>
</body>
</html>