I'm trying to export some data generated by our server, and import it into Googles Column Chart.
I've read the documentation regarding using JSON to import from the server, however, I'm not using a pie chart, and they haven't given much information about how they generate the JSON, and the format it quite different between a pie and column chart.
My server is currently returning the following code:
[['Week', 'Present', 'Absent', 'Other'],
['Week 1', 2, 0, 0],
['Week 2', 0, 0, 0],
['Week 3', 0, 0, 0],
['Week 4', 0, 0, 0],
['Week 5', 0, 0, 0]
]
Now, if I import this directly into the charts:
google.visualization.arrayToDataTable(response);
Then I get the error message 'Not an array'. Which I guess is true, actually being a string.
However, after googling, It would appear that using $.parseJSON would work. I've use this function on another Line graph google chart and its worked, however whenever I use $.parseJSON(response), all I get is
Uncaught SyntaxError: Unexpected token '
I cannot for the life of me see where the apostrophe is. All I want to do is import my server generated code into a chart.
Any help is always appreciated.