Increase axis autorange when bars have outside text labels #7675
+187
−138
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
This PR:
textpositionis'outside',orientationis vertical, andtextortexttemplateis provided and non-falsy, andtextangleis0or'auto'Screenshots
Before:

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"