a.getTime is not a function

3,263 views
Skip to first unread message

Sirius

unread,
Dec 14, 2017, 10:53:13 AM12/14/17
to Google Visualization API
This is my first time using the Google visualization API. I want to use a line graph to visualize records from a database. All the other components are working and I am successfully getting the data in json from the server.

{"cols":[{"label":"Date","type":"date"},{"label":"Systolic","type":"number"},{"label":"Diastolic","type":"number"},{"label":"Heart Rate","type":"number"}],"rows":[{"c":[{"v":"new Date(2017, 12, 13)"},{"v":25},{"v":55},{"v":66}]},{"c":[{"v":"new Date(2017, 12, 14)"},{"v":10},{"v":23},{"v":65}]}]}

a.getTime is not a function is the only that gets displayed.

Daniel LaLiberte

unread,
Dec 14, 2017, 11:56:32 AM12/14/17
to Google Visualization API
The format of your dates is wrong.  They are simply strings.  You probably meant to give the date using the string notation, but if so, you need to leave off the "new " prefix.

Also, the months in dates using this format are 0-based, so month 0 is January, and 12 is also January of the next year.

--
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+unsub...@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/1d1e385c-c98f-4e74-8dba-1966eb6c9a2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Sirius

unread,
Dec 18, 2017, 10:05:37 AM12/18/17
to Google Visualization API
It's working now, thank you!


On Thursday, December 14, 2017 at 4:56:32 PM UTC, Daniel LaLiberte wrote:
The format of your dates is wrong.  They are simply strings.  You probably meant to give the date using the string notation, but if so, you need to leave off the "new " prefix.

Also, the months in dates using this format are 0-based, so month 0 is January, and 12 is also January of the next year.
On Thu, Dec 14, 2017 at 10:53 AM, Sirius <hbm...@gmail.com> wrote:
This is my first time using the Google visualization API. I want to use a line graph to visualize records from a database. All the other components are working and I am successfully getting the data in json from the server.

{"cols":[{"label":"Date","type":"date"},{"label":"Systolic","type":"number"},{"label":"Diastolic","type":"number"},{"label":"Heart Rate","type":"number"}],"rows":[{"c":[{"v":"new Date(2017, 12, 13)"},{"v":25},{"v":55},{"v":66}]},{"c":[{"v":"new Date(2017, 12, 14)"},{"v":10},{"v":23},{"v":65}]}]}

a.getTime is not a function is the only that gets displayed.

--
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+unsub...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.



--

adm pecam

unread,
Nov 6, 2018, 2:57:35 PM11/6/18
to Google Visualization API
Hi, I am having the same issue.
My data is not plotting and saying a.getTime is not a function× . Could you please suggest how did you make that work.

Thank you so much
Reply all
Reply to author
Forward
0 new messages