Conversation
|
Thanks for this PR @NilsNemitz Axis spacing code has been a bit of a "here be dragons" area of the code-base, love that you've taken this on! The change looks good, some nit-picky comments regarding avoiding equality comparisons for floats. CodeQL is complaining about an unused import, and I'm curious if we can move away from that EDIT: also go ahead and remove the unused import 👍🏻 |
|
Hi @j9ac9k , Sorry for the delay, I've finally gotten around to figuring out why the pyside tests were failing: It seems that sometimes the power of ten calculation came back with integer values. That should no longer happen. The code now guesses the power of ten magnitude based on the IEEE exponent value. No more log10 calculation, at the cost of running one extra check for the tick multiplier. Can you see why the docs build is failing? |
|
Thanks for tackling this @NilsNemitz ...this was one of those areas that each time I thought about, I couldn't think of a good way to characterize ideal behavior better than what the library did already; but it appears you figured it out! Really appreciate the comments too ❤️ LGTM, merging! |
The automatic tick generator
AxisItem.tickSpacing()has a few quirks:These issues intensify when working with larger font sizes, particularly because labels current cannot extend beyond the height/width of the viewbox, and (large) labels near the edges are culled.
Here is a demo to play with some of the issues:
Changes
This PR replaces the generation code:
setTickDensity()makes it possible to adjust the auto-generated ticks somewhat without full manual specification.(*): This still makes implicit assumptions on text lable sizes, but referencing the actual sizes would be rather complexity.
Results
Current master branch:

Revised axis ticks:
