Customising formats of dates in data point tooltips

34 views
Skip to first unread message

Martin Underwood

unread,
Apr 12, 2017, 5:27:36 PM4/12/17
to Google Visualization API
I'm very new to Google Charts and I'm experimenting with very simple line graphs of a variable versus date or date and time. In the resulting graph, if I hover over a point, a tooltip pops up which gives the value of the variable and the date - but the date is always in US "MMM d, yy" format (eg "Jan 1, 17"). Is there a way of customising the format - for example "1 Jan 2015 13:47" with day before month (I'm British, and we prefer it that way round!) and with time as well as date.

I've attached the code, which is based very much on a Google Charts example with a few of my tweaks.

I know I could attach explicit tooltip text to each data point, but is there a more elegant method where you just change a format attribute for the tooltip.
dual line.htm

Daniel LaLiberte

unread,
Apr 12, 2017, 11:08:59 PM4/12/17
to Google Visualization API
Hi Martin,


and there is a separate page on Dates and Times here:  https://developers.google.com/chart/interactive/docs/datesandtimes

The Material charts don't have as much control over the date and time format, however, so you should probably stick with the classic corecharts.

Hope that helps.



--
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/dc4c2ada-eb66-4d3a-b4a6-5b676571daa6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Martin Underwood

unread,
Apr 13, 2017, 5:49:45 AM4/13/17
to Google Visualization API
On Thursday, 13 April 2017 04:08:59 UTC+1, Daniel LaLiberte wrote:
Hi Martin,


and there is a separate page on Dates and Times here:  https://developers.google.com/chart/interactive/docs/datesandtimes

The Material charts don't have as much control over the date and time format, however, so you should probably stick with the classic corecharts.

Hope that helps.

Many thanks for that, Daniel. That's helped considerably. I thought there must be a way along the lines of what you suggested, but I had the usual problem that I have: not knowing the words to Google for to get the answer I wanted :-)

Yes, I'd already come to the conclusion that Material had fewer features and less control than Classic. I tried to edit my post to remove all reference to Material so as not to complicate the issue, but Google Groups doesn't seem to let you edit a posting.
Reply all
Reply to author
Forward
0 new messages