-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Set cliponaxis: false
by default for bar traces with text
and textposition: 'auto'
or 'outside'
#7558
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
base: master
Are you sure you want to change the base?
Conversation
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.
This seems like a reasonable first step to fix these issues. Could you add a draftlog please?
What would be the downside of extending this to
Agreed, don't go down that route. You don't want to do anything inside |
@alexjohnson-kobold Good point! I'm happy with extending it to |
cliponaxis: false
by default for bar traces with text
and textposition: 'outside'
cliponaxis: false
by default for bar traces with text
and textposition:
'auto' or
'outside'`
cliponaxis: false
by default for bar traces with text
and textposition:
'auto' or
'outside'`cliponaxis: false
by default for bar traces with text
and textposition: 'auto'
or 'outside'
Description
Mitigation for #2001 / #2000
Normally the
cliponaxis
trace parameter istrue
by default, meaning that text outside the plotted area is clipped.However, since text is not taken into account when dtermining the axis range, this means that bar text placed outside the bar is almost always clipped by default, which is ugly.
This PR modifies the behavior of the
cliponaxis
parameter such that it is set tofalse
by default in the following scenario:text
, ANDtextposition
is set to'auto'
or'outside'
This results in text outside bars no longer being clipped at the default axis range.
Screenshots
Before
After
Caveats
Does not change behavior whenUpdated: Now applies to bothtextposition
is set to'auto'
(the default). Auto textposition typically places text inside the bar, but may place it outside occasionally if there is not enough space inside. So there is a (relatively rare) edge case where text could still be clipped.'auto'
and'outside'
'bar'
. We may want to extend this behavior to other trace types in the future if there is demand, but I figured a more targeted change makes more sense to start with.cliponaxis: true
. (I wonder if perhaps we should keep the defaultcliponaxis: true
when there are negative bars; however this risks getting into a really twisty maze of edge cases where we have to consider not only the bar values, but also the axis direction as well as which side of the plot the ticks are drawn on).