Skip to content Skip to sidebar Skip to footer

Google Charts Not Accepting Well Formed Array

Im writing a charting tool using the Google charts API. To change the timespan for the data that makes up the charts i'm sending a jquery post to a jsp servlet that returns a strin

Solution 1:

Your processed data looks like this:

[["Swedish", "68"], ["Pasta", "4"], ["Vegetarian", "2"],...

Shouldn't it be like this:

["Swedish", "Pasta", "Vegetarian"...
["68", "4", "2"...

Solution 2:

Got it! Two things created the bugs in the system.

This of course produces no errors:

catChartArray[i][1]= dataArray[parseInt(j+1)];

but it should be

catChartArray[i][1]= parseInt(dataArray[j+1]);

Also the servlet returned alot of empty lines that must have disrupted the array. Added

 <%@page trimDirectiveWhitespaces="true"%>

to my the jsp file i used for the post request.

Now everything works as expected.

Post a Comment for "Google Charts Not Accepting Well Formed Array"