fix(visualMap): prevent tooltip label overlap#21586
fix(visualMap): prevent tooltip label overlap#21586Resbi-Anik wants to merge 2 commits intoapache:masterfrom
Conversation
- Introduced a new margin constant for handle label overlap detection. - Added logic to merge handle labels when they overlap, improving visual clarity. - Refactored handle label position updates to accommodate new merging behavior. - Implemented a method to calculate the bounding rectangle of handle labels for accurate overlap testing. Resolves: apache#21585
|
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. |
|
Thanks for the fix, the overlap handling logic looks solid and the Could you also add a small regression case in
That would help guard against future regressions in label visibility/draggability transitions. |
- Implemented two new test cases: 'Color HueRange handles: merge on overlap' and 'Color HueRange handles: dual drag when apart'. - Each test case generates a dataset and configures the chart options to validate visualMap behavior. Resolves: apache#21585
|
Hi @Justin-ZS , |
|
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21586@5979d16 |
|
Hi @Justin-ZS, |
Since ECharts 6.1 is coming this week, I’ll merge it after the 6.1 release if there are no further comments from other maintainers. |

Resolves: #21585
Brief Information
This pull request is in the type of:
What does this PR do?
Prevents overlapping of visualMap handle tooltip labels when the slider handles are positioned close to each other.
Fixed issues
Details
Before: What was the problem?
When using visualMap with
calculable: true, the tooltip labels for the min and max values overlap when the slider handles are positioned close to each other.This makes the labels unreadable and affects usability.
After: How does it behave after the fixing?
The tooltip labels no longer overlap when the handles are close.
When the distance between handles is below a threshold, the labels are adjusted/merged to maintain readability and avoid visual collision.
When there is enough spece no "-" between the values
when the values are close enough
Document Info
One of the following should be checked.
Misc
Security Checking
ZRender Changes
Merging options
Other information
Tested with heatmap and visualMap slider in minimal configuration. The fix works without requiring additional user configuration.