Skip to content Skip to sidebar Skip to footer

Not A Valid 2d Array Google Chart

I have the current code that attempts to build a 2d array for the google charts. However I get an invalid 2D array error. What am i doing wrong? Thank you in advance //Request dat

Solution 1:

Your finalData array's first element needs to be a 2-element array:

var finalData = [['Date', 'SessionLength']];

Solution 2:

I think your doing wrong the 2D array initialization You should just write

var finalData = [];

because var finalData = [["SessionLength"]]; is creating an array which have single element as ["SessionLength"] which is one element array, then you are adding arrays which have 2 elements, so actually you get an invalid 2D array like this:

[["SessionLength"], ["2013-8-5", "13.5"], ["2013-7-29","19.7"]...]

Post a Comment for "Not A Valid 2d Array Google Chart"