Calendar Chart - n.getFullYear is not a function

24 views
Skip to first unread message

Jean-Luc Malvoisin

unread,
Apr 6, 2021, 5:58:09 AM4/6/21
to Google Visualization API

I am trying to render a Calendar Chart, but I face a "n.getFullYear is not a function" error and I can't find what's going wrong.

This is my client part:

google.charts.load("current", {packages:["calendar"], callback:function(){ getIt(where.getAttribute('data-chart-uri'), function(status,response){ var data = google.visualization.arrayToDataTable(response,false); var options = Object.assign({title: where.getAttribute('data-chart-title')||''}, response.options); google.charts.setOnLoadCallback(function(){ var chart = new google.visualization.Calendar(where); chart.draw(data, options); }); }); }});

Note: where is the targeted DOM Element and getIt is a fetch like function.

And this is what is sent by the web service (response):

[ [ { "label": "Date", "type": "date" }, { "label": "Number of individuals", "type": "number" } ], [ "2021-03-11", 1 ], [ "2021-03-24", 2 ], [ "2021-03-25", 1 ] ]

I can't figure out, what is wrong in the provided format or is it the way I use google.visualization.arrayToDataTable.

Thx for your help !
Reply all
Reply to author
Forward
0 new messages