-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Implement ticklabeloverflow to improve control over display of tick labels #5584
Conversation
@@ -136,6 +136,7 @@ module.exports = overrideAll({ | |||
tickvals: axesAttrs.tickvals, | |||
ticktext: axesAttrs.ticktext, | |||
ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), | |||
ticklabeloverflow: extendFlat({}, axesAttrs.ticklabeloverflow, {dflt: 'allow'}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't want a dflt
here, do you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good eye. Addressed in f833ce4.
src/plots/cartesian/axes.js
Outdated
else if(pushOverflow) { | ||
if(adjust.indexOf('left') !== -1) t.attr('text-anchor', 'start'); | ||
if(adjust.indexOf('right') !== -1) t.attr('text-anchor', 'end'); | ||
// more TODO: https://github.com/plotly/plotly.js/issues/3292 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could leave another branch open with this WIP for "push to ..." but I'd rather not have it commented out in the main codebase. Anyway the eventual solution is going to need to be a bit more complex than this: we'll want to push these labels only as far as necessary, and then if doing so causes them to intersect the next labels we should still hide them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by c9eaff2.
The new test images look great. I don't think we want the indicator mock to change though - if indicator labels overflow the div I think we should still show them. |
Co-authored-by: Alex Johnson <[email protected]>
Good call. Done in 0deec98. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go! 💃
⭐ please merge! |
Addressing #5404 by adding new attribute to
cartesian
axes (and few more places than use cartesian axis e.g.indicator
andcolorbar
, obviously notgl3d
).The options currently implemented are
allow
,hide past div
,hide past domain
.The default value when
ticklabelposition
is set to inside is 'hide past domain'.Otherwise on category and multicategory axes the default is 'allow'.
In other cases the "new" default (to fix the bug) is 'hide past div'.
This PR also paved the way so that other options such as
push to div
, andpush to domain
could be added later on the road to address #3292.@plotly/plotly_js