I'm trying to build a Google chart.
Current, I'm building an array using PHP's json_encode($array)
. So,, my array variable looks like this:
var array = [{"name":"John Doe","userId":"12","count":"31"},{"name":"Catherine Cookson","userId":"212","count":"12"},{"name":"Lady Gaga","userId":"61","count":"20"}];
I'm passing it into a function which builds the chart:
drawRetChart(array);
Which then uses the data array: data.addRows(array);
However, when I try to load the chart, I get an error: Error: Every row given must be either null or an array.
How do I resolve this?
您有大量的对象,您需要的是大量的数组。
var array = [[(key,val), (key,val), (key,val)],[array2], [array3]];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.