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 7ba40b9ae935e7f5fb6d405af744e415be1b4952 Author: plainheart <y...@all-my-life.cn> AuthorDate: Sat May 28 17:08:46 2022 +0800 fix(symbol): fix `squre` icon is not being respected, which behaves as the same as `rect` currently. --- src/chart/helper/Symbol.ts | 5 +++++ test/scatter.html | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/chart/helper/Symbol.ts b/src/chart/helper/Symbol.ts index 9295f306d..b28725420 100644 --- a/src/chart/helper/Symbol.ts +++ b/src/chart/helper/Symbol.ts @@ -79,6 +79,11 @@ class Symbol extends graphic.Group { symbolType, -1, -1, 2, 2, null, keepAspect ); + if (symbolType === 'square') { + // override symbol size + symbolSize[0] = symbolSize[1] = Math.min(symbolSize[0], symbolSize[1]); + } + symbolPath.attr({ z2: 100, culling: true, 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