Uh oh!
There was an error while loading. Please reload this page.
Increase axis autorange when bars have outside text labels - #7675
Conversation
55cb0eb to
1264314Compare1264314 to
a437597Comparee090b3a to
3cb2f47Compare
camdecoster
left a comment
There was a problem hiding this comment.
I left some syntax and refactoring comments, but this looks good.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
1ef511f to
acf38e1CompareCo-authored-by: Cameron DeCoster <cameron.decoster@gmail.com>
acf38e1 to
e0ab211CompareUh oh!
There was an error while loading. Please reload this page.
archmoj
commented
Feb 4, 2026
@emilykl Whereas this is potentially a breaking change for users, I'm wondering if you are going to revert this PR and introduce this change in v4? |
alexcjohnson
commented
Feb 4, 2026
IMO the previous behavior was a bug, and it's unlikely anyone depends on it, so I think including it now is the right call. |
Closes#2001
Adds a step during bar calc to add extra padding to axis range if bar has outside text labels.
Note: The first commit in this PR is just formatting changes. Use this diff to skip the first commit and see only the meaningful changes.
Codepen here! https://codepen.io/emilykl-code/pen/JoXQqLL
This is a stopgap fix for the fact that text labels are not taken into account during autorange calculations (see #2000).
Unfortunately, as discussed in that issue, modifying autorange to account for text labels is a significant amount of work, so I've opted for a more limited fix to address the issue identified in #2001.
Changes in this PR:
textpositionis'outside',orientationis vertical, andtextortexttemplateis provided and non-falsy, andtextangleis0or'auto'"cliponaxis": "false"from thehist_stackedimage mock, to demonstrate the effect of the changes in this PR (see below)Screenshots
Before:

After:

hist_stackedmock (withcliponaxis: falseremoved) Before:hist_stackedmock (withcliponaxis: falseremoved) After:Steps for testing
Use the following mock:
Verify that it looks like the "before" picture on
masterand the "after" picture on this branch.Other variations to test:
layout.yaxis.autorangeto"reversed"bar.textproperty instead ofbar.texttemplatelayout.barmodeto"stack"You can also load the
hist_stackedmock in the devtools as another test case.