diff --git a/src/chart/helper/createClipPathFromCoordSys.ts b/src/chart/helper/createClipPathFromCoordSys.ts index 7bc83d7def..74ec7f8e90 100644 --- a/src/chart/helper/createClipPathFromCoordSys.ts +++ b/src/chart/helper/createClipPathFromCoordSys.ts @@ -51,8 +51,12 @@ function createGridClipPath( height += lineWidth; // fix: https://github.com/apache/incubator-echarts/issues/11369 - x = Math.floor(x); - width = Math.round(width); + width = Math.ceil(width); + if (x !== Math.floor(x)) { + x = Math.floor(x); + // if no extra 1px on `width`, it will still be clipped since `x` is floored + width++; + } const clipPath = new graphic.Rect({ shape: { @@ -165,4 +169,4 @@ export { createGridClipPath, createPolarClipPath, createClipPath -}; \ No newline at end of file +}; diff --git a/test/clip-line-cap.html b/test/clip-line-cap.html new file mode 100644 index 0000000000..c444e3af5c --- /dev/null +++ b/test/clip-line-cap.html @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +