I tried this,
var rows = [];
for (var i = 0; i < 10; i++) {
rows.push(['row' + i, i]);
}
data.addRows(rows);
This seems to work but when i do the same with json,
var data = new google.visualization.DataTable();
data.addColumn('string', 'dbZipcode');
data.addColumn('number', 'countusers');
var rows = [];
for (var i = 0; i < response.customerlist.length; i++) {
rows.push(['Zipcode-' + response.customerlist[i].dbZipcode,
response.customerlist[i].countusers]);
}
data.addRows(rows);
I gives me an error Error: Type mismatch. Value 1 does not match type number in column index
. ANy suggestion.
and my json data looks like this,
{
"customerlist": [
{ "dbZipcode": "21313213", "countusers": "1" },
{ "dbZipcode": "2313213", "countusers": "1" },
{ "dbZipcode": "23324324", "countusers": "1" },
{ "dbZipcode": "2342432", "countusers": "1" },
{ "dbZipcode": "32424422343", "countusers": "1" },
{ "dbZipcode": "324324324", "countusers": "1" },
{ "dbZipcode": "324324324324", "countusers": "1" },
{ "dbZipcode": "3244324", "countusers": "1" },
{ "dbZipcode": "3422344", "countusers": "1" },
{ "dbZipcode": "342424324", "countusers": "1" },
{ "dbZipcode": "3424324", "countusers": "1" },
{ "dbZipcode": "435345", "countusers": "1" },
{ "dbZipcode": "627028", "countusers": "1" },
{ "dbZipcode": "641030", "countusers": "2" },
{ "dbZipcode": "642582", "countusers": "1" }
]
}