nothing is being displayed when i call the draw function. below is the code. please help

6 views
Skip to first unread message

avinash

unread,
Feb 20, 2012, 6:03:04 AM2/20/12
to Google Visualization API
<script type="text/javascript" src="https://www.google.com/jsapi"></
script>
<script type="text/javascript">



function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Month');
data.addColumn('number', 'Passengers');
<%
if(hmChart!=null)
{
Iterator itData = hmChart.keySet().iterator();
String year="";
int count=0;
while(itData.hasNext())
{
year = itData.next().toString();
count = hmChart.get(year);%>
data.addRow(['<%= year%>', <%=count%>]);
<%}}%>

var options = {
width: 400, height: 240,
title: 'Company Performance'
};

var chart = new
google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);

}
google.setOnLoadCallback(drawChart());
</script>

MrTik

unread,
Feb 20, 2012, 1:09:58 PM2/20/12
to google-visua...@googlegroups.com
Can you please post your complete code? More people might be able to help, if we can see what you are trying to accomplish.

Thanks.

MrTik

unread,
Feb 20, 2012, 1:18:59 PM2/20/12
to google-visua...@googlegroups.com
Also when I looked at your code and tried to make it work, I found out that you might be missing this line in your code.

<script type="text/javascript">
      google.load('visualization', '1', {packages: ['corechart']});
</script>

Give it a shot. If this does not work please post your entire code.

Regards.
Reply all
Reply to author
Forward
0 new messages