I have taken this example from google chart documentation, so it naturally works correctly.
if i replace this with:var data = google.visualization.arrayToDataTable([
['Age', 'Weight'],
[ 8, 12],
[ 4, 5.5],
]);
it still works- meaning my array values for arr1 and arr2 are being recognized.var data = google.visualization.arrayToDataTable([
['Age', 'Weight'],
[eval(arr1[0]),eval(arr2[0])],
[eval(arr1[1]),eval(arr2[1])],
[eval(arr1[2]),eval(arr2[2])],
]);
However if i replace this with
var data = google.visualization.arrayToDataTable([
['Age', 'Weight'],
for(i=0;i<arr1.length;i++){
[eval(arr1),eval(arr2)],
}
]);
I get syntax error pointing at 'for' in the javascript error console.
How do i populate the chart dynamically with a for loop(or otherwise). Can you please point the error out here ? Thanks a lot !