This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch fix/symbol-square
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 0adbfd53cb11a8c0afb9adbeb654312ef4dc0da8
Author: plainheart <y...@all-my-life.cn>
AuthorDate: Sat May 28 17:08:46 2022 +0800

    fix(symbol): fix `square` icon is not being respected, which behaves like 
`rect` currently.
---
 src/chart/helper/Symbol.ts |  7 ++++++-
 test/scatter.html          | 12 +++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/chart/helper/Symbol.ts b/src/chart/helper/Symbol.ts
index 9295f306d..7af1e1f07 100644
--- a/src/chart/helper/Symbol.ts
+++ b/src/chart/helper/Symbol.ts
@@ -395,7 +395,12 @@ class Symbol extends graphic.Group {
     }
 
     static getSymbolSize(data: SeriesData, idx: number) {
-        return normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize'));
+        const symbolSize = normalizeSymbolSize(data.getItemVisual(idx, 
'symbolSize'));
+        const symbolType = data.getItemVisual(idx, 'symbol');
+        if (symbolType === 'square') {
+            symbolSize[0] = symbolSize[1] = Math.min(symbolSize[0], 
symbolSize[1]);
+        }
+        return symbolSize;
     }
 }
 
diff --git a/test/scatter.html b/test/scatter.html
index c92256d0f..120be3156 100644
--- a/test/scatter.html
+++ b/test/scatter.html
@@ -43,11 +43,13 @@ under the License.
                 var data1 = [];
                 var data2 = [];
                 var data3 = [];
+                var data4 = [];
 
                 var names = [
                     'diamond, red, show inside label only on hover',
                     'green, show top label only on hover',
-                    'indigo, show inside label on normal'
+                    'indigo, show inside label on normal',
+                    'square'
                 ];
 
                 var random = function (max) {
@@ -58,6 +60,7 @@ under the License.
                     data1.push([random(5), random(5), random(2)]);
                     data2.push([random(10), random(10), random(2)]);
                     data3.push([random(15), random(10), random(2)]);
+                    data4.push([random(20), random(10), random(2)]);
                 }
 
                 chart.setOption({
@@ -142,6 +145,13 @@ under the License.
                             return val[2] * 40;
                         },
                         data: data3
+                    },
+                    {
+                        name: names[3],
+                        type: 'scatter',
+                        symbol: 'square',
+                        symbolSize: [50, 20],
+                        data: data4
                     }],
                     animationDelay: function (idx) {
                         return idx * 20;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org
For additional commands, e-mail: commits-h...@echarts.apache.org

Reply via email to