[Feature] [axis] add alignTicks for mutliple axis alignment. #16300
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.
Brief Information
This pull request is in the type of:
What does this PR do?
This PR adds
alignTicks
option to allow ticks alignment between multiple value or log axis.Similar PR: #13210
How it Works
When a value/log axis is set to
alignTicks: true
. It will find the first value/log axis on the same dimension that is not usealignTicks
and align the ticks to it.The align algorithm is bacially from radar series, which already has ticks alignment between multiple indicator axes, with some enhancement on the corner cases. The simple idea is find a good interval that having minimal extent that can contain the data. Here is a detail explaination
splitNumber
isticksNumber - 1
extent
andinterval
with thissplitNumber
usingcalcNiceExtent
.min
andmax
are both fixed. It will simply calculate theinterval
by(max - min) / splitNumber
max
is fixed. Try to calculatemin
bymax - interval * splitNumber
.interval
is from the second step. If the calculatedmin
is larger than the minimal value. Increase interval utilmin
is less than the minimal value.min
is fixed. Similar tomax
fixed case.min
andmax
are not fixed. Setmax
toextent[1]
calculated from the second step. Then it's similar to themax
fixed case. Note if the calculatedmin
andmax
cross the zero value. We need to check if the data extent cross and make sure they are both positive or negative.min
ormax
. We need to adjust the calculatedmin
andmax
proportionally.Limitations
alignTicks
with complexmin
,max
value, e.g.'dataMin'
,'dataMax'
, will lead to unreadable ticks.Fixed issues
#11390
#10928
Details
Before: What was the problem?
After: How is it fixed in this PR?
More conformance tests
Misc
Related test cases or examples to use the new APIs
N.A.
Others
Merging options
Other information