Faseehshahid246517 opened a new pull request, #21840:
URL: https://github.com/apache/echarts/pull/21840

   ## Brief Information
   
   This pull request is in the type of:
   
   - [ ] bug fixing
   - [x] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   Adds a new axis option `nameOffset` that shifts the axis name by a pixel 
offset after `nameGap` and the automatic overlap resolution (`nameMoveOverlap`) 
have been applied.
   
   
   
   ### Fixed issues
   
   - #21834: Support a post-overlap offset for axis names while keeping 
`nameMoveOverlap: true`
   
   
   ## Details
   
   ### Before: What was the problem?
   
   With `nameMoveOverlap: true`, `nameGap` is applied before overlap 
resolution. If the requested position still overlaps the axis labels, the axis 
name is moved automatically, so different `nameGap` values can end up at the 
same final position. The overlap boundary depends on label size, font, rotation 
and data, so developers cannot predict which offset to use. The only 
workaround, `nameMoveOverlap: false`, disables automatic collision avoidance 
entirely.
   
   
   
   
   ### After: How does it behave after the fixing?
   
   The new `nameOffset` option is applied as the last step: `nameGap` -> 
overlap resolution -> `nameOffset`.
   
   - `number`: signed pixel offset along the outward direction used by overlap 
resolution (positive = farther from the axis, negative = closer).
   - `[dx, dy]`: screen-space pixel offset.
   - Default is `0`, so existing charts are unchanged.
   - It applies whether `nameMoveOverlap` is `true` or `false`.
   
   ```js
   yAxis: {
     name: 'Axis title',
     nameLocation: 'middle',
     nameMoveOverlap: true,
     nameGap: 10,
     nameOffset: 15
   }
   ```
   
   
   
   
   
   ## Document Info
   
   One of the following should be checked.
   
   - [ ] This PR doesn't relate to document changes
   - [x] 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
   
   - `test/axis-name-offset.html` (visual cases)
   - `test/ut/spec/component/axis/nameOffset.test.ts` (unit tests)
   
   ### Merging options
   
   - [x] Please squash the commits into a single one when merging.
   
   ### Other information
   
   Docs PR for `apache/echarts-doc` will follow. I'm happy to adjust the API 
shape, for example dropping the `[dx, dy]` form if a smaller first version is 
preferred.
   <img width="1898" height="498" alt="image_2026-11-13_175615882" 
src="https://github.com/user-attachments/assets/658ab37e-6343-42aa-8a97-70b5536d3150";
 />
   <img width="1908" height="472" alt="image_2026-11-13_175623625" 
src="https://github.com/user-attachments/assets/1c8d77c3-b94d-4178-8149-c5fd94b3a561";
 />
   <img width="1904" height="487" alt="image_2026-11-13_175632442" 
src="https://github.com/user-attachments/assets/f7528a46-c4b8-4490-8438-a41ec0a85fa2";
 />
   


-- 
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]

  • [PR] feat(axis): add nameOffse... Faseehshahid246517 (via GitHub) via commits

Reply via email to