-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
rangebreaks sometimes draws the gridline on the wrong point #4692
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
It's not drawing the gridline on the wrong point; it's drawing a gridline inside the break, but due to the way the breaks work (removing from the first instant of Saturday until the last instant of Sunday), the break is at Monday. Simplest fix I can think of here is to shift the auto That happens here: plotly.js/src/plots/cartesian/axes.js Line 542 in 5b6abbb
but mostly here (you can see we explicitly chose Sunday): plotly.js/src/plots/cartesian/axes.js Lines 816 to 819 in 5b6abbb
|
Oh actually ignore line 542, I'm not sure when that happens but I suspect it's largely for pseudo-axis fallbacks. |
Removed my previous comment which was not correct. |
@alexcjohnson are you proposing a weekend-specific fix or do you think this is a generalizable approach? |
Also, we should make sure this works well with bars and |
I was suggesting weekend-specific. I feel like any attempt to generalize beyond that will create other confusion... maybe not, maybe if you also remove a specific Monday we could make the tick say Tuesday somehow. That seems tougher to implement though. We could try and just use the end of the break as the tick value (ie reverting the special logic I had @archmoj figure out to position the tick at the end of the break but label it with the label it would have gotten in the absence of breaks) and see if the label comes out right. I just worry about edge cases like if you remove until 1pm Monday, will the tick say Tuesday even though there are 11 hours of Monday left after the tick? The reason for my concern is that we aggressively set the tick label rounding based on
in that future where breaks apply to category axes, or tickson applies to dates 😁 |
Oh right :) Phew! |
This seems like a good idea to me actually, and in fact will be more forward-compatible with a world where we actually render a gap where the break is, right? The break would come right before the gridline/ticklabel in that case. Using some value in the break is not going to work well in that case. |
OK, we can try it. Maybe it'll just generally work out? It'll certainly be simpler code, with apologies to @archmoj for the extra complexity (specifically the |
See Jan 3 here: https://codepen.io/nicolaskruchten/pen/oNXQmLR?editors=1010
The text was updated successfully, but these errors were encountered: