From aa09cc02a5e499781affd292191c11c866216690 Mon Sep 17 00:00:00 2001 From: BENcorry <1417224785@qq.com> Date: Mon, 18 Dec 2023 11:50:54 +0800 Subject: [PATCH] fix(axis): custom axis tags disappear when the page is zoomed (#5940) Co-authored-by: ben.wen --- .../animation/stocks-keyframe/interval2-0.svg | 180 +- .../animation/stocks-keyframe/interval2-1.svg | 264 +-- .../api/chart-emit-scrollbar-filter/step0.svg | 890 ++------ .../api/chart-emit-scrollbar-filter/step1.svg | 660 +----- .../api/chart-emit-slider-filter/step0.svg | 1848 ++--------------- .../api/chart-emit-slider-filter/step1.svg | 1670 ++------------- .../chart-render-update-attributes/step0.svg | 316 +-- .../chart-render-update-attributes/step1.svg | 316 +-- .../snapshots/api/chartChangeDataLegend.svg | 594 +----- .../snapshots/api/markChangeData.svg | 1251 +++-------- src/runtime/plot.ts | 2 +- 11 files changed, 925 insertions(+), 7066 deletions(-) diff --git a/__tests__/integration/snapshots/animation/stocks-keyframe/interval2-0.svg b/__tests__/integration/snapshots/animation/stocks-keyframe/interval2-0.svg index b7192a0cb4..926bac15a1 100644 --- a/__tests__/integration/snapshots/animation/stocks-keyframe/interval2-0.svg +++ b/__tests__/integration/snapshots/animation/stocks-keyframe/interval2-0.svg @@ -944,6 +944,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 0 @@ -971,6 +972,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 100 @@ -998,6 +1000,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 200 @@ -1297,7 +1300,7 @@ stroke-opacity="0.1" /> - + - + @@ -1409,7 +1412,7 @@ @@ -1456,6 +1459,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 0 @@ -1464,12 +1468,12 @@ - 100 - - - - 50 @@ -1512,12 +1496,12 @@ - 200 - - - - 100 @@ -1851,7 +1815,7 @@ stroke-opacity="0.1" /> - + - + @@ -1963,7 +1927,7 @@ @@ -2010,6 +1974,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 0 @@ -2018,12 +1983,12 @@ - 100 - - - - 50 @@ -2066,12 +2011,12 @@ - 200 - - - - 100 @@ -2504,6 +2429,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2000 @@ -2532,6 +2458,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2002 @@ -2560,6 +2487,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2004 @@ -2588,6 +2516,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2006 @@ -2616,6 +2545,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2008 @@ -2644,6 +2574,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2010 @@ -2701,7 +2632,7 @@ stroke-opacity="0.1" /> - + - + @@ -2813,7 +2744,7 @@ @@ -2860,6 +2791,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 0 @@ -2868,12 +2800,12 @@ - 100 - - - - 20 @@ -2916,12 +2828,12 @@ - 200 - - - - 40 diff --git a/__tests__/integration/snapshots/animation/stocks-keyframe/interval2-1.svg b/__tests__/integration/snapshots/animation/stocks-keyframe/interval2-1.svg index 037d2bf4c2..6bd41fee55 100644 --- a/__tests__/integration/snapshots/animation/stocks-keyframe/interval2-1.svg +++ b/__tests__/integration/snapshots/animation/stocks-keyframe/interval2-1.svg @@ -621,7 +621,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -633,7 +633,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -645,7 +645,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -657,7 +657,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -669,7 +669,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -681,7 +681,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -781,7 +781,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,0 C 339 0,678 0,678 0" + d="M 0,0 L 678,0" stroke-opacity="0.1" /> @@ -793,7 +793,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,0 C 339 0,678 0,678 0" + d="M 0,0 L 678,0" stroke-opacity="0.1" /> @@ -805,7 +805,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,0 C 339 0,678 0,678 0" + d="M 0,0 L 678,0" stroke-opacity="0.1" /> @@ -944,6 +944,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 0 @@ -971,6 +972,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 100 @@ -998,6 +1000,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 200 @@ -1133,7 +1136,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -1145,7 +1148,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -1157,7 +1160,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -1169,7 +1172,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -1181,7 +1184,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -1193,7 +1196,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -1293,11 +1296,11 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,0 C 339 0,678 0,678 0" + d="M 0,0 L 678,0" stroke-opacity="0.1" /> - + - + @@ -1388,7 +1391,7 @@ @@ -1409,7 +1412,7 @@ @@ -1456,6 +1459,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 0 @@ -1464,30 +1468,9 @@ - - - 100 - - 50 @@ -1512,30 +1496,9 @@ - - - 200 - - 100 @@ -1687,7 +1651,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846158 C 0 38.76923076923079,0 0,0 0" + d="M 0,77.53846153846158 L 0,0" stroke-opacity="0.1" /> @@ -1699,7 +1663,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846158 C 0 38.76923076923079,0 0,0 0" + d="M 0,77.53846153846158 L 0,0" stroke-opacity="0.1" /> @@ -1711,7 +1675,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846158 C 0 38.76923076923079,0 0,0 0" + d="M 0,77.53846153846158 L 0,0" stroke-opacity="0.1" /> @@ -1723,7 +1687,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846158 C 0 38.76923076923079,0 0,0 0" + d="M 0,77.53846153846158 L 0,0" stroke-opacity="0.1" /> @@ -1735,7 +1699,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846158 C 0 38.76923076923079,0 0,0 0" + d="M 0,77.53846153846158 L 0,0" stroke-opacity="0.1" /> @@ -1747,7 +1711,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846158 C 0 38.76923076923079,0 0,0 0" + d="M 0,77.53846153846158 L 0,0" stroke-opacity="0.1" /> @@ -1847,11 +1811,11 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,0 C 339 0,678 0,678 0" + d="M 0,0 L 678,0" stroke-opacity="0.1" /> - + - + @@ -1942,7 +1906,7 @@ @@ -1963,7 +1927,7 @@ @@ -2010,6 +1974,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 0 @@ -2018,30 +1983,9 @@ - - - 100 - - 50 @@ -2066,30 +2011,9 @@ - - - 200 - - 100 @@ -2241,7 +2166,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -2253,7 +2178,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -2265,7 +2190,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -2277,7 +2202,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -2289,7 +2214,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -2301,7 +2226,7 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,77.53846153846155 C 0 38.769230769230774,0 0,0 0" + d="M 0,77.53846153846155 L 0,0" stroke-opacity="0.1" /> @@ -2504,6 +2429,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2000 @@ -2532,6 +2458,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2002 @@ -2560,6 +2487,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2004 @@ -2588,6 +2516,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2006 @@ -2616,6 +2545,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2008 @@ -2644,6 +2574,7 @@ class="axis-label-item" dy="11.5px" opacity="0.45" + visibility="visible" > 2010 @@ -2697,11 +2628,11 @@ stroke="rgba(29,33,41,1)" stroke-width="0.5" stroke-dasharray="3,4" - d="M 0,0 C 339 0,678 0,678 0" + d="M 0,0 L 678,0" stroke-opacity="0.1" /> - + - + @@ -2792,7 +2723,7 @@ @@ -2813,7 +2744,7 @@ @@ -2860,6 +2791,7 @@ text-anchor="end" class="axis-label-item" opacity="0.45" + visibility="visible" > 0 @@ -2868,30 +2800,9 @@ - - - 100 - - 20 @@ -2916,30 +2828,9 @@ - - - 200 - - 40 diff --git a/__tests__/integration/snapshots/api/chart-emit-scrollbar-filter/step0.svg b/__tests__/integration/snapshots/api/chart-emit-scrollbar-filter/step0.svg index 180bfdc683..9813b70042 100644 --- a/__tests__/integration/snapshots/api/chart-emit-scrollbar-filter/step0.svg +++ b/__tests__/integration/snapshots/api/chart-emit-scrollbar-filter/step0.svg @@ -7,7 +7,7 @@ > - + - + @@ -348,7 +348,7 @@ > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2001-01 - - - - - - - 2001-02 - - - - - - - 2001-03 - - - - - - - 2001-04 - - - - - - - 2001-05 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - + > + - - - 100 - + + - - - - - 200 - + + - - - - - 300 - + + + + + + + + - - - 400 - - - - - - - - - value - + transform="matrix(1,0,0,1,0,0)" + class="grid-region-group" + /> 0 100 200 300 400 @@ -1626,11 +1011,38 @@ + + + + value + + + - + - + - + @@ -363,7 +363,7 @@ > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2001-01 - - - - - - - 2001-02 - - - - - - - 2001-03 - - - - - - - 2001-04 - - - - - - - 2001-05 - - - - - @@ -1347,305 +1053,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - 100 - - - - - - - 200 - - - - - - - 300 - - - - - - - 400 - - - - - - + @@ -187,14 +187,14 @@ class="handle-icon-group" > @@ -833,1609 +833,151 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2001-01 - - - - - - - 2001-02 - - - - - - - 2001-03 - - - - - - - 2001-04 - - - - - - - 2001-05 - - - - - - - 2001-06 - - - - - - - 2001-07 - - - - - - - 2001-08 - - - - - - - 2001-09 - - - - - - - 2001-10 - - - - - - - 2001-11 - - - - - - - 2001-12 - - - - - - - 2002-01 - - - - - - - 2002-02 - - - - - - - 2002-03 - - - - - - - 2002-04 - - - - - - - 2002-05 - - - - - - - 2002-06 - - - - - - - 2002-07 - - - - - - - 2002-08 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - 100 - - - - - - - 200 - - - - - - - 300 - - - + + + + + + - - - 400 - + + - - - - - 500 - + + + + + + + + + + + + + + + + + - - - 600 - - - - - - - - - value - + transform="matrix(1,0,0,1,0,0)" + class="grid-region-group" + /> 0 100 200 300 400 500 600 @@ -2809,11 +1344,38 @@ + + + + value + + + - + - + @@ -200,14 +200,14 @@ class="handle-icon-group" > @@ -850,1050 +850,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2001-01 - - - - - - - 2001-02 - - - - - - - 2001-03 - - - - - - - 2001-04 - - - - - - - 2001-05 - - - - - - - 2001-06 - - - - - - - 2001-07 - - - - - - - 2001-08 - - - - - - - 2001-09 - - - - - - - 2001-10 - - - - - - - 2001-11 - - - - - - - 2001-12 - - - - - - - 2002-01 - - - - - - - 2002-02 - - - - - - - 2002-03 - - - - - - - 2002-04 - - - - - - - 2002-05 - - - - - - - 2002-06 - - - - - - - 2002-07 - - - - - - - 2002-08 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 100 - - - - - - - 200 - - - - - - - 300 - + class="grid-line" + stroke="rgba(29,33,41,1)" + stroke-width="0.5" + stroke-dasharray="3,4" + d="M 0,0 L 504.71999970563456,0" + stroke-opacity="0.1" + /> - - - - - 400 - + + - - - 500 - - - - - - - - - value - + transform="matrix(1,0,0,1,0,0)" + class="grid-region-group" + /> @@ -2359,7 +999,6 @@ y1="0" x2="0" y2="0" - visibility="hidden" class="axis-tick-item" stroke-width="1" stroke="rgba(29,33,41,1)" @@ -2368,9 +1007,9 @@ @@ -2381,7 +1020,6 @@ y1="0" x2="0" y2="0" - visibility="hidden" class="axis-tick-item" stroke-width="1" stroke="rgba(29,33,41,1)" @@ -2390,9 +1028,9 @@ @@ -2403,7 +1041,6 @@ y1="0" x2="0" y2="0" - visibility="hidden" class="axis-tick-item" stroke-width="1" stroke="rgba(29,33,41,1)" @@ -2412,9 +1049,9 @@ @@ -2425,7 +1062,6 @@ y1="0" x2="0" y2="0" - visibility="hidden" class="axis-tick-item" stroke-width="1" stroke="rgba(29,33,41,1)" @@ -2434,9 +1070,9 @@ @@ -2447,51 +1083,6 @@ y1="0" x2="0" y2="0" - visibility="hidden" - class="axis-tick-item" - stroke-width="1" - stroke="rgba(29,33,41,1)" - opacity="0.45" - /> - - - - - - - - - - - - - 0 - - - - 100 200 300 400 500 - + + + + - - - 600 - - - + value + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 94 - - - - - - - 96 - - - - - - - 98 - - - - - - - 100 - - - - - - - 102 - - - - - @@ -776,7 +482,7 @@ > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 94 - - - - - - - 96 - - - - - - - 98 - - - - - - - 100 - - - - - - - 102 - - - - - @@ -776,7 +482,7 @@ > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10:10 - - - - - - - 10:20 - - - - - - - 10:30 - - - - - - - 10:40 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - 2 - - - - - - - 4 - - - - - - - 6 - - - - - - - 8 - - - - - @@ -1575,7 +1033,7 @@ > - Action - - - - - - - Shooter - - - - - - - Other - - - - - - - Sports - - - - - - - Strategy - - - - - - - - - genre - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Action - - - - - - - Shooter - - - - - - - Other - - - - - - - Sports - - - - - - - Strategy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - 50 - - - - - - - 100 - - - - - - - 150 + Action - 200 + Shooter - 250 + Other - 300 + Sports - 350 + Strategy - + - sold + genre + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 50 100 150 200 250 300 350 @@ -2224,6 +1454,33 @@ + + + + sold + + + @@ -2243,7 +1500,7 @@ >