diff --git a/src/chart/helper/SymbolDraw.js b/src/chart/helper/SymbolDraw.js index 2cefafbd79772bd386004f8ae01a0f64fccd834a..79bb35cceac8f73e34af4a616aad29cea08ce53f 100644 --- a/src/chart/helper/SymbolDraw.js +++ b/src/chart/helper/SymbolDraw.js @@ -19,6 +19,11 @@ define(function (require) { var symbolDrawProto = SymbolDraw.prototype; + function symbolNeedsDraw(data, idx, isIgnore) { + var point = data.getItemLayout(idx); + return point && !isNaN(point[0]) && !isNaN(point[1]) && !(isIgnore && isIgnore(idx)) + && data.getItemVisual(idx, 'symbol') !== 'none'; + } /** * Update symbols draw by new data * @param {module:echarts/data/List} data @@ -33,24 +38,21 @@ define(function (require) { data.diff(oldData) .add(function (newIdx) { - if (!(isIgnore && isIgnore(newIdx)) - && data.getItemVisual(newIdx, 'symbol') !== 'none' - ) { + var point = data.getItemLayout(newIdx); + if (symbolNeedsDraw(data, newIdx, isIgnore)) { var symbolEl = new SymbolCtor(data, newIdx); - symbolEl.attr('position', data.getItemLayout(newIdx)); + symbolEl.attr('position', point); data.setItemGraphicEl(newIdx, symbolEl); group.add(symbolEl); } }) .update(function (newIdx, oldIdx) { var symbolEl = oldData.getItemGraphicEl(oldIdx); - if ((isIgnore && isIgnore(newIdx)) - || data.getItemVisual(newIdx, 'symbol') === 'none' - ) { + var point = data.getItemLayout(newIdx); + if (!symbolNeedsDraw(data, newIdx, isIgnore)) { group.remove(symbolEl); return; } - var point = data.getItemLayout(newIdx); if (!symbolEl) { symbolEl = new SymbolCtor(data, newIdx); symbolEl.attr('position', point); diff --git a/src/chart/line/LineView.js b/src/chart/line/LineView.js index aeedb7a70733509e0414bcf9bcabec9671b425c9..de22b5062079174c740bc9bdc7ceca533d4e4ffa 100644 --- a/src/chart/line/LineView.js +++ b/src/chart/line/LineView.js @@ -329,7 +329,7 @@ define(function(require) { data.setItemGraphicEl(dataIndex, symbol); // Stop scale animation - symbol.stopAnimation(true); + symbol.stopSymbolAnimation(true); this.group.add(symbol); } diff --git a/src/chart/pie/PieView.js b/src/chart/pie/PieView.js index 52957518e030375fb4d898453f9ed20c6bf42d0c..b3ab6eb35bbefa8b3311eb3d047cf6a0a22e2fcc 100644 --- a/src/chart/pie/PieView.js +++ b/src/chart/pie/PieView.js @@ -214,7 +214,7 @@ define(function (require) { data.getItemLayout(idx), itemModel.get('selected'), seriesModel.get('selectedOffset'), - seriesModel.ecModel.get('animation') + seriesModel.get('animation') ); function onEmphasis() {