You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "Justin-ZS (via GitHub)" <gi...@apache.org> on 2026/04/20 10:11:38 UTC
Re: [PR] fix: lock label moveoverlap in grid [echarts]
Justin-ZS commented on code in PR #21506:
URL: https://github.com/apache/echarts/pull/21506#discussion_r3109863499
##########
src/label/LabelManager.ts:
##########
@@ -457,8 +459,78 @@ class LabelManager {
return item.layoutOption.moveOverlap === 'shiftY';
});
- shiftLayoutOnXY(labelsNeedsAdjustOnX, 0, 0, width);
- shiftLayoutOnXY(labelsNeedsAdjustOnY, 1, 0, height);
+ // Group labels by grid (not by series) so that labels of multiple series
+ // in the same grid avoid overlapping each other.
+ const labelsByGridX: Dictionary<LabelLayoutWithGeometry[]> = {};
+ const labelsByGridY: Dictionary<LabelLayoutWithGeometry[]> = {};
+
+ function getGridName(inputItem: LabelLayoutWithGeometry): string {
Review Comment:
This bucket/bounds lookup only works for Cartesian because it reads `coordinateSystem.master.name/getRect()`. `singleAxis` and `matrix` keep `name` and `getRect()` on `coordinateSystem` itself, so they still fall into `grid_default` and share whole-canvas bounds. Could we use `const owner = coordSys.master || coordSys` here?
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org