-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Closed
Labels
bugenThis issue is in EnglishThis issue is in EnglishpendingWe are not sure about whether this is a bug/new feature.We are not sure about whether this is a bug/new feature.
Description
Version
5.4.3
Link to Minimal Reproduction
https://codepen.io/rexskz/pen/WNLweyw
Steps to Reproduce
- Open the codepen link.
- Look at the rightmost position of the line.
Current Behavior
It's clipped incorrectly, but the leftmost position of the line is okay.
Expected Behavior
The rightmost position should not be clipped, just like the leftmost one.
Environment
- OS: macOS Ventura
- Browser: Chrome 116.0.5845.110
- Framework: /Any additional comments?
The root cause is that ECharts uses Math.round in createClipPathFromCoordSys.ts:
const rect = cartesian.getArea();
let width = rect.width;
width = Math.round(width);The width here can be a float with the decimal part less than 0.5:
Finally, it results in the incorrect clipPath, just 1px smaller than expected:
This issue can only be reproduced in a container with a specific width (503px in the codepen link).
This issue might be related to #11369; considering it meant to extend the clipPath and use Math.floor on x, I think it's okay to use Math.ceil on width to ensure the clipPath is large enough to contain the whole line (with cap).
Metadata
Metadata
Assignees
Labels
bugenThis issue is in EnglishThis issue is in EnglishpendingWe are not sure about whether this is a bug/new feature.We are not sure about whether this is a bug/new feature.