Resbi-Anik opened a new pull request, #21885:
URL: https://github.com/apache/echarts/pull/21885

   <!-- Please fill in the following information to help us review your PR more 
efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   Shows one handle label, not two identical ones, when the two handle labels 
of a calculable continuous visualMap overlap and show the same text.
   
   
   
   ### Fixed issues
   
   - #21884
   
   
   
   ## Details
   
   ### Before: What was the problem?
   
   Since #21637, overlapping handle labels are pushed apart instead of merged. 
When both handles have the same value, or values that format to the same text 
via `precision`/`formatter`, the same number is shown twice (`50 50`, or `50` 
stacked above `50` in vertical layout).
   
   <img width="1520" height="800" alt="issueB-before" 
src="https://github.com/user-attachments/assets/137716c9-c615-4fd4-8cbf-cffba45da0e7";
 />
   
   
   
   ### After: How does it behave after the fixing?
   
   One label is shown, centered on the handles:
   
   <img width="1520" height="800" alt="issueB-after" 
src="https://github.com/user-attachments/assets/f242cbdc-e2fc-4321-b030-1370614566a4";
 />
   
   - The check runs only when the labels overlap, after the existing overlap 
test in `_updateHandle`. Labels that are far apart with the same text (e.g. a 
constant `formatter`) keep two labels.
   - The formatted text is compared, not the raw values, so values that format 
to the same text (e.g. via `precision`) are also covered.
   - Dragging the single label moves both handles (the same `'all'` drag mode 
#21637 uses for close labels). The handle thumbs can still pull the handles 
apart.
   - The hidden label is set `invisible` + `silent`, so it can't catch pointer 
events. Both are reset on every `_updateHandle`, so no extra state is kept.
   - `visualMap.formatter` / `formatValueText` are unchanged.
   
   
   
   ## Document Info
   
   One of the following should be checked.
   
   - [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
   
   ### Security Checking
   
   - [ ] This PR uses security-sensitive Web APIs.
   
   <!-- PLEASE CHECK IT AGAINST: 
<https://github.com/apache/echarts/wiki/Security-Checklist-for-Code-Contributors>
 -->
   
   ### ZRender Changes
   
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   - Unit test: 
`test/ut/spec/component/visualMap/continuousHandleLabel.test.ts` (horizontal + 
vertical: same value, same formatted value, same text but far apart, and back 
to two labels).
   - Visual test: new case "Single handle label when both handles show the same 
text" in `test/visualMap-continuous.html`.
   
   ### Merging options
   
   - [x] Please squash the commits into a single one when merging.
   
   ### Other information
   
   Related: #21766 / #21807 (vertical labels overlapping when the handles are 
close). That push-apart behavior is unchanged here; the single-label path only 
applies when the overlapping labels have the same text.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to