react-timeseries-charts icon indicating copy to clipboard operation
react-timeseries-charts copied to clipboard

Time axis support for arbitrary time zones

Open alistairmgreen opened this issue 7 years ago • 3 comments

My time series consists of an array of moment objects which have an explicit UTC offset value. This offset is not generally the same as the user's local time zone. Is there any way to preserve the UTC offset when plotting with react-timeseries-charts? The only options that I can see in the documentation are to show times as local or as UTC.

Thanks in advance.

Background information

I am working on an application to display GPS logger traces for glider pilots (a rewrite of IGCWebView using React). I would like to plot a graph of altitude against time, and it makes sense to use the time zone of the country where the flight took place. For example, I am in the UK (local time = UTC) but would like to see the time displayed as UTC + 10 when looking at logger traces from Australia. The moment.format() method takes care of this automatically.

alistairmgreen avatar Nov 01 '16 20:11 alistairmgreen

This would be really nice to support, but is not currently possible. We don't use a lot of d3 anymore, particularly when it comes to drawing, but we do sit on top of d3 scales pretty heavily. See https://github.com/d3/d3/issues/2375 for more on this issue in d3, which interestingly gives some hope at the end of that thread.

In the future we want to move the axis functionality to react-axis, so this would be the place to solve this. If you have any time to contribute to that goal, that would be greatly appreciated. I've added an issue there.

pjm17971 avatar Nov 01 '16 21:11 pjm17971

@pjm17971 thanks for confirming.

If you are able to implement a custom tick formatting function as suggested in #86 then that could be used as a workaround.

alistairmgreen avatar Nov 03 '16 22:11 alistairmgreen

Looks like pond TimeSeries supports passing the time zone via tz:, to the moment.js constructors. However, the chart axis fails to adjust display based on the date timezone.

bugeats avatar May 23 '19 19:05 bugeats