Here's one way of doing it (assumes you want everything in arr2):

var dataArray = [
    ['Time','Count']
];

// interate over all of arr2
for (var n=0; n < arr2.length; n++) { 
    dataArray.push([arr2[n], parseInt(arr[n])]), 
}
dataArray.push([arr2(mycount),parseInt(arr[mycount])]);

var data = new google.visualization.arrayToDataTable(dataArray); ​ 

On Monday, June 18, 2012 12:00:28 PM UTC-4, [email protected] wrote:
>
> Is it possible to have a variable array of points in a line or bar 
> chart? 
> Your code example shows 
>
> var data = new google.visualization.arrayToDataTable ([ 
>
> ['heading1','heading2'], 
>
> [data point, datapoint], 
> [data point, datapoint] 
>
> ]); 
>
> All of the points are hard coded, but I don't know how many points I'm 
> going to have.  It could be any where from 0-96. 
>
> I have successfully passed in arrays so it reads as 
>
> ['heading1', 'heading2'], 
> [arr1[0],arr2[0]], 
> [arr1[1],arr2[1]] 
> ]); 
> and so forth but I'm having to build ridiculously large case 
> statements to handle the arrays so i don't get errors. 
>
> I tried building in a for next loop for the array elements, but I'm 
> getting syntax errors on that as well. 
>
> Here is my code with the loop that is giving syntax errors: 
>
> var data = new google.visualization.arrayToDataTable([ 
>             ['Time','Count'], 
>             for (var n=0;n<96;n++) 
>             { 
>             [arr2[n],    parseInt(arr[n]) ], 
>             } 
>             [arr2(mycount),parseInt(arr[mycount])] 
>
>             ]); 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/oxyNn5oZ1HQJ.
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-visualization-api?hl=en.

Reply via email to