plottable icon indicating copy to clipboard operation
plottable copied to clipboard

Timezone Support

Open aicioara opened this issue 10 years ago • 12 comments

Example: Have a plot with 2 time axis, one which shows time in NYC, one which shows time in SF

aicioara avatar Jul 09 '15 21:07 aicioara

http://blog.cortexintel.com/blog/2014/09/local-timezones-with_d3js/

aicioara avatar Jul 09 '15 21:07 aicioara

Looking into this it seems like there is no nice way of doing it without taking an additional dependency.

meme After some research, it seems like Moment.js - timezones is the best option.

Timezones seems like a legitimate request for me as something that has been asked for a lot.

The way I would architect the change is by changing the Axes.Time

  • Add a .setTimezone endpoint that would be in sync with the MomentJS timezones
  • Use MomentJS internally for presentation only. Since timezone is just an offset (ish), it seems reasonable to me that all the logic should be in the view. The scales and internal data should not be altered.

Aside: A common and different use case would be supporting UTC standard time on our Axes.Time, since the users might specify their time format like that. http://jsfiddle.net/9a2gz3Ld/1/

Also:: Do we want an additional dependency? Can we make it optional? i.e. issue a warning only when the user tries to use timezones, but make it optional for the rest (i.e. do not force users take dependencies they never use?)

aicioara avatar Jul 09 '15 21:07 aicioara

Multiple timezones POC http://jsfiddle.net/xvro4L0s/6/ . It's a bit buggy (and of course hacky due to missing features from our end), but I think it is promising. trying to see if I can get it work with all daylight savings fun before concluding anything

aicioara avatar Jul 10 '15 00:07 aicioara

The missing feature is being able to synchronize scales and / or adding multiple scales to a single plot through a .x(), .y()

aicioara avatar Jul 10 '15 00:07 aicioara

With the above Daylight savings work as well screen shot 2015-07-09 at 5 23 13 pm

aicioara avatar Jul 10 '15 00:07 aicioara

What does not work is the autodomaining logic http://jsfiddle.net/xvro4L0s/8/ But that should be solved as part of "Let's not make this a hack anymore"

aicioara avatar Jul 10 '15 00:07 aicioara

Might be worth solving with https://github.com/palantir/plottable/issues/545 and https://github.com/palantir/plottable/issues/1703

aicioara avatar Jul 10 '15 00:07 aicioara

To clarify this specific request, contour would like to have two different timezones on the same axis (see screenshot from hipmunk.com that Andrei posted above). Start by adding in this functionality, and we can iterate on specific requests later on.

christinaforney avatar Oct 07 '15 22:10 christinaforney

Hi, any updates on this one? I see the plottable-moment repo, but nothing in the wiki there about this issue...

jasperSpeicher avatar Aug 15 '17 02:08 jasperSpeicher

Since I have some context on this from the time I worked on it, the solution that was proposed was to implement timezone support as a Plottable Addon and this way not force Plottable users on taking additional bloat when such functionality was not needed. I am not sure if that project was eventually completed, since it only has 100 lines of code and hasn't been updated in 2 years.

aicioara avatar Aug 19 '17 02:08 aicioara

Ok, thank you. So if I want to show time axis labels (and tier structures) in UTC timezone, sounds like I should be computing the offset and handing the axis and the x accessors Date objects with the offset applied?

jasperSpeicher avatar Aug 22 '17 23:08 jasperSpeicher

UTC might be easier, since JS supports it natively. It could be a matter of just setting the X accessor or the axis formatter to convert from Local time to UTC with methods such as new Date().toUTCString() and siblings. Hope this helps.

aicioara avatar Aug 23 '17 02:08 aicioara