This is my code:
var data = new google.visualization.DataTable();
data.addColumn('date', 'Value');
data.addColumn('number', 'Value');
var jsonData = [ { "added_date" : "new Date(2018,0,31)",
"count" : "42" },
{ "added_date" : "new Date(2018,1,1)",
"count" : "127" },
{ "added_date" : "new Date(2018,1,2)",
"count" : "26" },
{ "added_date" : "new Date(2018,1,3)",
"count" : "94" },
{ "added_date" : "new Date(2018,1,5)",
"count" : "14" },
{ "added_date" : "new Date(2018,1,6)",
"count" : "31" },
{ "added_date" : "new Date(2018,1,7)",
"count" : "2" },
{ "added_date" : "new Date(2018,1,8)",
"count" : "214" },
{ "added_date" : "new Date(2018,1,9)",
"count" : "26" },
{ "added_date" : "new Date(2018,1,10)",
"count" : "26" },
{ "added_date" : "new Date(2018,1,11)",
"count" : "10" },
{ "added_date" : "new Date(2018,1,12)",
"count" : "102" },
{ "added_date" : "new Date(2018,1,13)",
"count" : "6" } ];
for (var i = 0; i < jsonData.length; i++) {
data.addRow([jsonData[i].added_date,parseInt(jsonData[i].count)]);
}
var options = {
title: 'Date wise Usage'
};
var chart = new
google.visualization.ColumnChart(document.getElementById("columnchart"));
chart.draw(data, options);
when execute i have got the error
*Uncaught Error: Type mismatch. Value new Date(2018,0,31) does not match
type date in column index 0*
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/9ebd54fa-ecf8-4d92-8bbb-2130e3052251%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.