Skip to content

Conversation

Justin-ZS
Copy link
Contributor

@Justin-ZS Justin-ZS commented Aug 28, 2025

Brief Information

This pull request is in the type of:

  • bug fixing

What does this PR do?

Fix hideOverlap not working on emphasis state for data labels.

Fixed issues

截屏2025-08-28 12 05 30 截屏2025-08-28 16 27 51

录屏2025-08-28 13 44 03

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:

  1. Added EmphasisManager class to manage label overlap during emphasis state
  2. Used reordering mechanism to give emphasis labels highest priority
  3. Modified hideOverlap function to support pre-ordered mode, emphasis state labels also follow overlap rules
  4. Added state listeners for dynamic overlap handling

Document Info

  • 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

Copy link

echarts-bot bot commented Aug 28, 2025

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.

Copy link

echarts-bot bot commented Aug 28, 2025

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.

@Ovilia Ovilia requested a review from 100pah September 2, 2025 02:26
Copy link
Contributor

github-actions bot commented Sep 2, 2025

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21233@abd13df

@Justin-ZS
Copy link
Contributor Author

@100pah Could you help to review the PR? Thanks!

@Justin-ZS
Copy link
Contributor Author

@plainheart @pissang Could you help to review the PR? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant