The following is the code that I basically want to implement using a loop
function:
function drawChart() {
var data1 = google.visualization.arrayToDataTable(<?php echo
$mychartdatax1 ?>);
var data2 = google.visualization.arrayToDataTable(<?php echo
$mychartdatax2 ?>);
var data3 = google.visualization.arrayToDataTable(<?php echo
$mychartdatax3 ?>);
var data4 = google.visualization.arrayToDataTable(<?php echo
$mychartdatax4 ?>);
var data5 = google.visualization.arrayToDataTable(<?php echo
$mychartdatax5 ?>);
var options = {
colors: ['#FFA500'],
legend: {position:'none'},
};
var chart1 = new
google.visualization.ColumnChart(document.getElementById('chart_div1'));
var chart2 = new
google.visualization.ColumnChart(document.getElementById('chart_div2'));
var chart3 = new
google.visualization.ColumnChart(document.getElementById('chart_div3'));
var chart4 = new
google.visualization.ColumnChart(document.getElementById('chart_div4'));
var chart5 = new
google.visualization.ColumnChart(document.getElementById('chart_div5'));
setTimeout(function(){chart1.draw(data1, options);},10);
setTimeout(function(){chart2.draw(data2, options);},10);
setTimeout(function(){chart3.draw(data3, options);},10);
setTimeout(function(){chart4.draw(data4, options);},10);
setTimeout(function(){chart5.draw(data5, options);},10);
}
I am drawing an unknown number of charts the charts divs are named via php
and are generated on the page, the data is stored in the variable format as
shown above, the problem exists when I try to loop through and pull the
data I keep running into an error. Please assist.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/c90abe1c-cb04-4ecf-9fcb-caa08cf05bcd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.