fix(marker): correct markArea on inverse category axis - #21657
Conversation
|
Thanks for your contribution! Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only. |
|
Hi maintainers — would this inverse-category-axis markArea fix be of interest for review? The PR is ready from my side, and I’m happy to address any feedback. Thanks for your time. |
plainheart
left a comment
There was a problem hiding this comment.
Hi, thanks for your contribution! The fix looks good to me! I plan to include this fix into the patch version 6.1.1. Can you rebase to the release branch?
|
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
Brief Information
This pull request is in the type of:
What does this PR do?
Fixes
markAreaband positioning on inverted category axes.Fixed issues
inverse: truedoesn't work for the first bar #21652:markAreaon a horizontal bar chart withyAxis.inverse: truerenders one category band off.Details
Before: What was the problem?
For a horizontal bar chart with an inverted category axis:
the
markAreafor the first category rendered on the second category, whilemarkLineat the same{ yAxis: 0 }value rendered on the correct first category.The root cause was that
fixOnBandTicksCoordsexpanded category tick coordinates to band boundaries using a positivebandWidth, assuming coordinates increase as tick values increase. On inverted axes, the coordinate extent is reversed, so the half-band boundary shift moved in the wrong direction.After: How does it behave after the fixing?
markAreaandmarkLinenow cover the same category for both normal and inverted category axes.The fix makes the on-band tick boundary step follow the axis coordinate direction:
+bandWidth-bandWidthBlast radius note: this is unchanged for normal/ascending axis extents because
coordStep === bandWidthin that case. It is also unchanged foraxisTick.alignWithLabel: truebecausefixOnBandTicksCoordsreturns before this code path. Non-category axes are not affected.A visual regression case was added to
test/bar-markArea.htmlwith normal and inverted horizontal bar charts. The test overlays a redmarkLineat{ yAxis: 0 }so the bluemarkAreacan be verified against the same category.Document Info
One of the following should be checked.
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
test/bar-markArea.htmlMerging options
Other information
Validation run locally:
I also verified the reported repro with SVG SSR before and after the fix:
markAreapolygon covered the second band whilemarkLinestayed on the first bandmarkAreapolygon covers the first band and aligns withmarkLine