I do call draw method. Maybe I'm doing something wrong, I am not very
familiar with Javascript. Here's the create chart code:
/* chart_type: ("bar", "pie", etc.....)
* canvas: html tag (got by document.getElementBy())
* data: Array of data points
* xaxis: name of xaxis
* yaxis: name of yaxis
*/
function create_chart(chart_type,canvas,data,xaxis,yaxis) {
switch(chart_type) {
case "bar":
google.load("visualization", "1", {packages:
['corechart']});
google.setOnLoadCallback(draw_bar_chart);
break;
// etc........
default:
alert("Unknown chart");
return;
}
function draw_bar_chart() {
var d = new google.visualization.DataTable();
d.addColumn('string', xaxis);
d.addColumn('string', yaxis);
d.addRows(data.length);
for(var i=0; i < data.length; i++) {
var cols = data[i].split("!,!");
d.setValue(i,0,cols[j]);
d.setValue(i,0,cols[j]);
}
var chart = new
google.visualization.ColumnChart(canvas);
chart.draw(d, { width:500,height:300, title: xaxis,
hAxis: {title: yaxis, titleTextStyle:
{color: 'red'}} } );
}
// Other chart_draw functions.......
}
--
You received this message because you are subscribed to the Google Groups
"Google Chart API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-chart-api?hl=en.