I thought that I was approaching this correctly but it appears not.
I have the following function:
function oMain(){
var allMyData = <? echo htmlspecialchars($jsData, ENT_NOQUOTES, 'utf-8')?>;
var data = new google.visualization.DataTable();
data.addColumn('string', 'x');
data.addColumn('number', 'mid');
var i=0;
alert(allMyData.length);
for(i=0;i<allMyData.length;i++){
}
alert(allMyData[i+1,0] + "," + allMyData[i+1,1]);
}
where allMyData looks like this:
[["20121031095013","1.315"],["20121031095029","1.315"],["20121031095046","1.315"],["20121031095102","1.315"],["20121031095118","1.315"],["20121031095134","1.315"],....
which to me seems okay.
Now:
My Alert shows me something like this:
20121031095013,1.315,20121031095029,1.315
where I am anticipating:
20121031095029,1.315
Could someone please help me see the error i am making?
Thank you
allMyData[i+1,0]returns the first array inside that other huge array. I think you meant this:alert(allMyData[i+1][0] + "," + allMyData[i+1][1]);That way, you are selecting the array
i+1, and the the separate values inside of that.If you want a separate alert for every array inside your array, you need to place the alert statement inside the for loop: