Does it work if you leave out the "new " before the Date?  The string
notation (useful with JSON) does not support the extra "new " which is a
JavaScript instance constructor notation.

On Tue, Feb 13, 2018 at 1:49 AM, anup sharma <
anupsharma.technotechin...@gmail.com> wrote:

> 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 google-visualization-api+unsubscr...@googlegroups.com.
> To post to this group, send email to google-visualization-api@
> googlegroups.com.
> 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
> <https://groups.google.com/d/msgid/google-visualization-api/9ebd54fa-ecf8-4d92-8bbb-2130e3052251%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
dlalibe...@google.com <dlalibe...@google.com>   5CC, Cambridge MA

-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
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/CAOtcSJNLaZwzobKwuL18G_yoD88UpQ6j5WUjQ-chBe9fD6kMnw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to