AxisItem: Add adjustable label overlap tolerances, vertical overlap by default#2836
Merged
j9ac9k merged 2 commits intopyqtgraph:masterfrom Nov 11, 2023
Merged
Conversation
added 2 commits
October 8, 2023 15:15
Member
|
Thanks @NilsNemitz sorry for the wait, this LGTM, merging! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This extends / adjusts the functionality added in #2385 to stop axis labels sticking out of the allocated space. That certainly avoids overlap, it leaves less room for labels, and makes it so that ticks at the edges of the axis are never labeled.
The main problem identified in #2385 was an overlap of the x-axis labels of adjacent plots in a layout. While the width of the x-axis plots grows for larger numbers, the height of the y axis labels remains constant, so overlap is much less problematic there.
This PR
hideOverlappingLabelsto allow a user specified amount of overlap: The default of 15 pixels tolerance for enabled overlap is too small at larger font sizes. This functionality was discussed for Add style option 'hideOverlappingLabels' #2385, but wasn't ultimately added. The previously allowed values of True and False function the same as before.setTickSpacing()