-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
enable plotting vs time on 23 and 25 hour days #2872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't know why plotly can't offer some kind of setting to deal with Standard Time to DST or DST to Standard Time transitions. It seems that if the x-axis is a Date() object, the offset information is simply ignored. Here is a work-around for the issue: ` // first, determine if the first and last x array elements have the same time zone offset // if the x array elements are in "date-time" format, convert them to numeric values (otherwise comment the next line out) // create a new array t[] comprised of Date() objects based on the x[] array and the offset difference // The trick is now to create 2 traces. traces[0] will be used to plot the y[] array values using the x[] array while traces[1] will be used to plot the y[] array values using the t[] array. Also, traces[0] will be displayed but will not display hover info while traces[1] will be invisible but display hover info. var traces = []; // visible trace, no hover info // invisible trace, hover info var layout = { Plotly.react(gd, traces, layout); |
I'm trying to find a way to plot values over time on 23 and 25 hour days for daylight savings time (DST). Below is my example code that illustrates the problem, and the two resulting plots. The time stamps in x_23 and x_25 are all one hour apart. They reflect the "US/Pacific" time zone. In the spring forward case, I would expect to see twenty-three hours along the x-axis. And, in fall back, twenty-five. But, both times plotly shows 24. In spring forward, there is a visual gap in the spacing of the second and third markers. And, in fall back, there is a visual overlap.
A suggested approach would be to allow the programmer to optionally assign a time zone to the x-axis. In my case, I would assign
US/Pacific
. Then, plotly knows to adjust for DST if applicable. Might also want to allow assignment of a 'local' time zone. In that case, plotly would get the timezone from the computer on which it's running. If the programmer makes no assignment, plotly's behavior remains as is. Nobody's code gets broken.A similar alternative would be to allow the programmer to set a flag to
true
if they want the behavior that is aware of DST. A value offalse
would keep the current behavior. Again, nobody's code gets broken.I found two similar issues, but neither was really addressed.
plotly/plotly.js#171
plotly/plotly.js#4358
The text was updated successfully, but these errors were encountered: