-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Incorrect automatic date labels on X axis #482
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
@meglio I can't reproduce this. Here's what I tried: http://codepen.io/etpinard/pen/ONBmrx |
Ah it must be a timezone-related issue. Here's what I'm getting: This issue is possible a duplicated of #171 |
The dates I'm feeding to Plotly.js are in format What is confusing is that the black popup labels along the X axis are still correct. The static X-labels is what is wrong. |
If this is a timezone issue, how can it be that static labels are incorrect while the hover labels are correct? I would expect both to be incorrect in such a case. |
If you zoom in on that point, you'll see that the label and data point aren't exactly at the same location. They should be a few hours apart, one on April 8, one on April 9. |
This seems to have been fixed - probably by #1194. Feel free to reopen if you still see the problem. |
Hi, It seems that I run into the same issue again, but now it's on month level. This is not a timezone issue, is it? https://plot.ly/~olavl/6/#plot The hover date is correct, the x-axis label date not. |
@analytics-bootcamp you're right, that's not a timezone issue. The issue there is that we automatically put the label "Aug 2018" at August 1, which is essentially at your bar for July 31. The ticks are not labeling the bars, though in this case they're very close to the bars, they're labeling axis positions. You can force the behavior you want with eg: Plotly.relayout(gd,{
'xaxis.tick0':'2000-01-31', // canonical tick on the last day of the month
// (which automatically sets tickmode: 'linear')
'xaxis.dtick':'M1', // can't use auto ticks with tick0, so you have to specify 1-month ticks
'xaxis.tickformat':'%b %Y' // eg 'Jul 2018', otherwise we'll show 'Jul 31'
// (and year when necessary)
}) I'm not really sure how we could figure out automatically that this is what you want though. |
Data is provided from Apr 7 to Apr 22:
The very first X-label says Apr 8.
Expected: Apr 9 (3rd day starting from Apr 7).
The conflict also can be clearly seen when mouse-hovering the corresponding data point:
Data for bug reproduction
Days (X axis):
Number of responses (Y axis):
The text was updated successfully, but these errors were encountered: