From 5f156ad45f4ff03efe7812e525edabb5abef8747 Mon Sep 17 00:00:00 2001 From: sushuang Date: Thu, 19 Apr 2018 01:35:09 +0800 Subject: [PATCH] Fix remove of bar and candlestick. --- src/chart/bar/BarView.js | 20 +++++++------- src/chart/candlestick/CandlestickView.js | 15 ++++------- test/-cases.js | 1 + test/bar-stream-large.html | 16 +++++++----- ...bar-large1.html => bar-stream-large1.html} | 26 +++++++++++++++---- 5 files changed, 46 insertions(+), 32 deletions(-) rename test/{bar-large1.html => bar-stream-large1.html} (84%) diff --git a/src/chart/bar/BarView.js b/src/chart/bar/BarView.js index 01ad89974..7ee5fc5ba 100644 --- a/src/chart/bar/BarView.js +++ b/src/chart/bar/BarView.js @@ -152,17 +152,15 @@ export default echarts.extendChartView({ _clear: function (ecModel) { var group = this.group; var data = this._data; - if (ecModel && ecModel.get('animation')) { - if (data) { - data.eachItemGraphicEl(function (el) { - if (el.type === 'sector') { - removeSector(el.dataIndex, ecModel, el); - } - else { - removeRect(el.dataIndex, ecModel, el); - } - }); - } + if (ecModel && ecModel.get('animation') && data && !this._isLargeDraw) { + data.eachItemGraphicEl(function (el) { + if (el.type === 'sector') { + removeSector(el.dataIndex, ecModel, el); + } + else { + removeRect(el.dataIndex, ecModel, el); + } + }); } else { group.removeAll(); diff --git a/src/chart/candlestick/CandlestickView.js b/src/chart/candlestick/CandlestickView.js index 511dcca48..d2a96b832 100644 --- a/src/chart/candlestick/CandlestickView.js +++ b/src/chart/candlestick/CandlestickView.js @@ -39,11 +39,6 @@ var CandlestickView = ChartView.extend({ } }, - _clear: function () { - this.group.removeAll(); - this._data = null; - }, - _renderNormal: function (seriesModel) { var data = seriesModel.getData(); var oldData = this._data; @@ -129,12 +124,12 @@ var CandlestickView = ChartView.extend({ }, remove: function (ecModel) { - var group = this.group; - var data = this._data; + this._clear(); + }, + + _clear: function () { + this.group.removeAll(); this._data = null; - data && data.eachItemGraphicEl(function (el) { - el && group.remove(el); - }); }, dispose: zrUtil.noop diff --git a/test/-cases.js b/test/-cases.js index a5fb56871..38324e8c3 100644 --- a/test/-cases.js +++ b/test/-cases.js @@ -41,6 +41,7 @@ 'scatter-gps.html', 'scatter-weibo.html', 'bar-stream-large.html', + 'bar-stream-large1.html', 'candlestick-large1.html', 'lines-flight.html', 'lines-stream-large.html', diff --git a/test/bar-stream-large.html b/test/bar-stream-large.html index 9164410d4..00fa0743f 100644 --- a/test/bar-stream-large.html +++ b/test/bar-stream-large.html @@ -10,13 +10,15 @@
+ -- GitLab