This is an automated email from the ASF dual-hosted git repository. ovilia pushed a commit to branch feat-visualMap-itemSymbol in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 71ec19420546adb326c89761223f841810bf3f84 Author: Ovilia <zwl.s...@gmail.com> AuthorDate: Mon Feb 8 15:21:28 2021 +0800 fix(visualMap): use itemSymbol as default symbol type and fix #5719 --- src/component/visualMap/VisualMapModel.ts | 9 +++++++-- test/visualMap-scatter-colorAndSymbol.html | 11 +++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/component/visualMap/VisualMapModel.ts b/src/component/visualMap/VisualMapModel.ts index 6da2a7e..5dd886c 100644 --- a/src/component/visualMap/VisualMapModel.ts +++ b/src/component/visualMap/VisualMapModel.ts @@ -39,6 +39,7 @@ import Model from '../../model/Model'; import GlobalModel from '../../model/Global'; import SeriesModel from '../../model/Series'; import List from '../../data/List'; +import {PiecewiseVisualMapOption} from './PiecewiseModel'; const mapVisual = VisualMapping.mapVisual; const eachVisual = VisualMapping.eachVisual; @@ -483,6 +484,10 @@ class VisualMapModel<Opts extends VisualMapOption = VisualMapOption> extends Com const symbolSizeExists = (controller.inRange || {}).symbolSize || (controller.outOfRange || {}).symbolSize; const inactiveColor = this.get('inactiveColor'); + const itemSymbol = this.type === 'visualMap.piecewise' + ? (this as VisualMapModel<PiecewiseVisualMapOption>).get('itemSymbol') + : null; + const defaultSymbol = itemSymbol || 'roundRect'; each(this.stateList, function (state: VisualState) { @@ -501,7 +506,7 @@ class VisualMapModel<Opts extends VisualMapOption = VisualMapOption> extends Com if (visuals.symbol == null) { visuals.symbol = symbolExists && zrUtil.clone(symbolExists) - || (isCategory ? 'roundRect' : ['roundRect']); + || (isCategory ? defaultSymbol : [defaultSymbol]); } if (visuals.symbolSize == null) { visuals.symbolSize = symbolSizeExists @@ -511,7 +516,7 @@ class VisualMapModel<Opts extends VisualMapOption = VisualMapOption> extends Com // Filter square and none. visuals.symbol = mapVisual(visuals.symbol, function (symbol) { - return (symbol === 'none' || symbol === 'square') ? 'roundRect' : symbol; + return (symbol === 'none' || symbol === 'square') ? defaultSymbol : symbol; }); // Normalize symbolSize diff --git a/test/visualMap-scatter-colorAndSymbol.html b/test/visualMap-scatter-colorAndSymbol.html index ca096f2..0be5849 100644 --- a/test/visualMap-scatter-colorAndSymbol.html +++ b/test/visualMap-scatter-colorAndSymbol.html @@ -86,7 +86,8 @@ under the License. dimension: 3, seriesIndex: 0, max: 10, - color: ['red', 'pink', 'black'] + color: ['red', 'pink', 'black'], + itemSymbol: 'circle' }, { right: 0, @@ -98,7 +99,8 @@ under the License. backgroundColor: '#eee', inRange: { symbol: ['rect', 'line', 'path://M 100 100 L 300 100 L 200 300 z'] - } + }, + itemSymbol: 'diamond' }, { left: 'center', @@ -116,9 +118,10 @@ under the License. { gte: 0, color: 'green', - symbol: 'rect' + // symbol: 'rect' } - ] + ], + itemSymbol: 'circle' } ], series: [ --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org