From f078c62f87da56da62fc3200b88010f29f1ea0cb Mon Sep 17 00:00:00 2001 From: plainheart Date: Wed, 5 Jan 2022 19:15:04 +0800 Subject: [PATCH 1/2] fix(polar): fix symbols are clipped unexpectedly for the tiny offset. --- src/coord/polar/Polar.ts | 5 +++-- test/clip.html | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/coord/polar/Polar.ts b/src/coord/polar/Polar.ts index 912f6c7777..e7b9db6cce 100644 --- a/src/coord/polar/Polar.ts +++ b/src/coord/polar/Polar.ts @@ -228,7 +228,8 @@ class Polar implements CoordinateSystem, CoordinateSystemMaster { // Start angle and end angle don't matter const dx = x - this.cx; const dy = y - this.cy; - const d2 = dx * dx + dy * dy; + // minus a tiny value 1e-4 to avoid being clipped unexpectedly + const d2 = dx * dx + dy * dy - 1e-4; const r = this.r; const r0 = this.r0; @@ -265,4 +266,4 @@ interface PolarArea extends CoordinateSystemClipArea { clockwise: boolean } -export default Polar; \ No newline at end of file +export default Polar; diff --git a/test/clip.html b/test/clip.html index 00ccf44770..a560d071b5 100644 --- a/test/clip.html +++ b/test/clip.html @@ -116,6 +116,19 @@ data1.push([Math.random() * 10, Math.random() * 360]); } + data1.push({ + value: [5, 82], + name: 'This point shouldn\'t be clipped', + itemStyle: { + color: 'red' + }, + label: { + show: true, + formatter: '👆{b}👆', + position: 'bottom' + } + }); + var option = { polar: {}, angleAxis: { From f64d1ebf9fec1b7d4f682965c19baa18976ca144 Mon Sep 17 00:00:00 2001 From: plainheart Date: Wed, 5 Jan 2022 19:25:13 +0800 Subject: [PATCH 2/2] test: tweak test title. --- test/clip.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/clip.html b/test/clip.html index a560d071b5..165e3f73f3 100644 --- a/test/clip.html +++ b/test/clip.html @@ -150,7 +150,7 @@ }] }; var chart = testHelper.create(echarts, 'scatter-clip-polar', { - title: 'Scatter Clip on Polar', + title: ['Scatter Clip on Polar', 'Shrink the page, this red point shouldn\'t be clipped'], option: option, height: 400, buttons: makeToggleChartButtons(function (clip) {