fix(datalabel): hideOverlap not work on emphasis state
Brief Information
This pull request is in the type of:
- [x] bug fixing
What does this PR do?
Fix hideOverlap not working on emphasis state for data labels.
Fixed issues
-
#20744
-
#19192
Details
Before: What was the problem?
When data labels have hideOverlap enabled, all overlapping labels are forcibly displayed during emphasis state (hover or other emphasis triggers), completely ignoring the overlap detection settings. This causes dense label overlapping and affects readability.
After: How does it behave after the fixing?
- Emphasis labels get the highest display priority
- Other labels that overlap with emphasis labels are intelligently hidden
- Non-overlapping labels display normally
- Original overlap handling logic is restored when exiting emphasis state
Fix Method:
- Added
EmphasisManagerclass to manage label overlap during emphasis state - Used reordering mechanism to give emphasis labels highest priority
- Modified
hideOverlapfunction to support pre-ordered mode, emphasis state labels also follow overlap rules - Added state listeners for dynamic overlap handling
Document Info
- [x] This PR doesn't relate to document changes
- [ ] The document should be updated later
- [ ] The document changes have been made in apache/echarts-doc#xxx
Misc
ZRender Changes
- [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
Related test cases or examples to use the new APIs
N.A.
Others
Merging options
- [ ] Please squash the commits into a single one when merging.
Other information
Thanks for your contribution! The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.
To reviewers: If this PR is going to be described in the changelog in the future release, please make sure this PR has one of the following labels: PR: doc ready, PR: awaiting doc, PR: doc unchanged
This message is shown because the PR description doesn't contain the document related template.
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21233@88eb99f
@100pah Could you help to review the PR? Thanks!
@plainheart @pissang Could you help to review the PR? Thanks!
@Justin-ZS Hi, I've voted you to be a committer of Apache ECharts due to your continuous contribution. Can you provide an Email address for me to send our invitation. Please add my We-chat oviliazhang with a note "Justin-ZS" so that I can add you to our committer group. Thanks!
@Justin-ZS Hi, I've voted you to be a committer of Apache ECharts due to your continuous contribution. Can you provide an Email address for me to send our invitation. Please add my We-chat oviliazhang with a note "Justin-ZS" so that I can add you to our committer group. Thanks!
Thank you! I’m so happy to hear that! I've sent the We-chat friend request. My Email is [email protected]
@plainheart @100pah Could you help to review? Thanks!