use DateFormat with Annotated Time Line? need timeZone

705 views
Skip to first unread message

Lisa

unread,
Sep 30, 2009, 3:07:55 PM9/30/09
to Google Visualization API
Annotated Time Line does not seem to support using formatters. The
following works with Table, for example, but not Annotated Time Line.

var dateFormatter = new google.visualization.DateFormat({pattern: 'M/
dd/yy hh:mm aa Z', timeZone: -6});
dateFormatter.format(data, 0);


Annotated Time Line does have a separate configuration parameter for a
date pattern. It works, BUT it's missing the ability to set a
TimeZone:

var chart = new google.visualization.AnnotatedTimeLine
(document.getElementById('chart_div'));
chart.draw(data, {dateFormat: 'M/dd/yy hh:mm aa Z'});


It there any way I can specify a timezone with Annotated Time Line?

Kris

unread,
Oct 30, 2009, 8:13:23 AM10/30/09
to Google Visualization API
I'm also suffering with this problem. Does anyone know a fix?

VizGuy

unread,
Nov 1, 2009, 3:36:50 AM11/1/09
to google-visua...@googlegroups.com
This chart does not support time zones, and all times are always in 'local' time.

The reason for this is that if you add timezones to this chart, you will end up with each user seeing a different times based on the browser (the user) zone, and while useful in some cases, it is not what people want to do in most cases.

The reason for the different mechanism for formatting here, is that the chart must be aware of the formatter and not only of the formatted values, as in some cases it has to display values that were not originally in the data, but that are manipulations of the input.

Regards,
VizGuy

Bob

unread,
Nov 2, 2009, 4:48:39 AM11/2/09
to Google Visualization API
Kris & Lisa,
I've solved the problem by returning the timezone of the generated
data in the package from the server, and then offsetting it in the
JavaScript by simply adding or subtracting the offset to get it to the
local time of the user's browser.
It's not perfect, but it's pretty darn good, and it's been all I've
needed for Chicago, NYC & London users, so I'd say it's a decent work-
around.

Bob

Lisa

unread,
Dec 16, 2009, 12:28:38 PM12/16/09
to Google Visualization API
I worked around it by handling all timezone info on the server side,
adjusting as needed when I generate the DataTable.
> > > >AnnotatedTime Line does not seem to support using formatters.  The
> > > > following works with Table, for example, but notAnnotatedTime Line.
>
> > > > var dateFormatter = new google.visualization.DateFormat({pattern: 'M/
> > > > dd/yy hh:mm aa Z', timeZone: -6});
> > > > dateFormatter.format(data, 0);
>
> > > >AnnotatedTime Line does have a separate configuration parameter for a
Reply all
Reply to author
Forward
0 new messages