提交 5f156ad4 编写于 作者: S sushuang

Fix remove of bar and candlestick.

上级 faa78f73
...@@ -152,17 +152,15 @@ export default echarts.extendChartView({ ...@@ -152,17 +152,15 @@ export default echarts.extendChartView({
_clear: function (ecModel) { _clear: function (ecModel) {
var group = this.group; var group = this.group;
var data = this._data; var data = this._data;
if (ecModel && ecModel.get('animation')) { if (ecModel && ecModel.get('animation') && data && !this._isLargeDraw) {
if (data) { data.eachItemGraphicEl(function (el) {
data.eachItemGraphicEl(function (el) { if (el.type === 'sector') {
if (el.type === 'sector') { removeSector(el.dataIndex, ecModel, el);
removeSector(el.dataIndex, ecModel, el); }
} else {
else { removeRect(el.dataIndex, ecModel, el);
removeRect(el.dataIndex, ecModel, el); }
} });
});
}
} }
else { else {
group.removeAll(); group.removeAll();
......
...@@ -39,11 +39,6 @@ var CandlestickView = ChartView.extend({ ...@@ -39,11 +39,6 @@ var CandlestickView = ChartView.extend({
} }
}, },
_clear: function () {
this.group.removeAll();
this._data = null;
},
_renderNormal: function (seriesModel) { _renderNormal: function (seriesModel) {
var data = seriesModel.getData(); var data = seriesModel.getData();
var oldData = this._data; var oldData = this._data;
...@@ -129,12 +124,12 @@ var CandlestickView = ChartView.extend({ ...@@ -129,12 +124,12 @@ var CandlestickView = ChartView.extend({
}, },
remove: function (ecModel) { remove: function (ecModel) {
var group = this.group; this._clear();
var data = this._data; },
_clear: function () {
this.group.removeAll();
this._data = null; this._data = null;
data && data.eachItemGraphicEl(function (el) {
el && group.remove(el);
});
}, },
dispose: zrUtil.noop dispose: zrUtil.noop
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
'scatter-gps.html', 'scatter-gps.html',
'scatter-weibo.html', 'scatter-weibo.html',
'bar-stream-large.html', 'bar-stream-large.html',
'bar-stream-large1.html',
'candlestick-large1.html', 'candlestick-large1.html',
'lines-flight.html', 'lines-flight.html',
'lines-stream-large.html', 'lines-stream-large.html',
......
...@@ -10,13 +10,15 @@ ...@@ -10,13 +10,15 @@
</head> </head>
<body> <body>
<style> <style>
html, body, #main0 { #snapshot {
width: 100%; width: 150;
height: 100%; height: 100;
margin: 0; background: #fff;
border: 5px solid rgba(0,0,0,0.5);
} }
</style> </style>
<div id='main0'></div> <div id='main0'></div>
<img id="snapshot"/>
<script> <script>
require(['echarts'], function (echarts) { require(['echarts'], function (echarts) {
...@@ -61,7 +63,7 @@ ...@@ -61,7 +63,7 @@
'(1) Check all bars rendered (full of xAxis)', '(1) Check all bars rendered (full of xAxis)',
'(2) And check roam.', '(2) And check roam.',
'(3) Check click legend', '(3) Check click legend',
'(4) "finished" should be printed on console' '(4) Check snapshot rendering when "finished"'
], ],
option: option, option: option,
info: { info: {
...@@ -71,7 +73,9 @@ ...@@ -71,7 +73,9 @@
}); });
chart.on('finished', function () { chart.on('finished', function () {
console.log('finished'); var url = chart.getDataURL();
var snapshotEl = document.getElementById('snapshot');
snapshotEl.src = url;
}); });
}); });
......
...@@ -15,9 +15,18 @@ ...@@ -15,9 +15,18 @@
background: #146402; background: #146402;
color: #fff; color: #fff;
} }
#snapshot {
width: 150;
height: 100;
background: #fff;
border: 5px solid rgba(0,0,0,0.5);
}
</style> </style>
<div id="main0"></div> <div id="main0"></div>
<img id="snapshot"/>
<script> <script>
...@@ -79,12 +88,8 @@ ...@@ -79,12 +88,8 @@
} }
}, },
dataZoom: [{ dataZoom: [{
// startValue: 48,
// endValue: 99,
type: 'inside' type: 'inside'
}, { }, {
// startValue: 48,
// endValue: 99,
type: 'slider' type: 'slider'
}], }],
xAxis: { xAxis: {
...@@ -122,10 +127,21 @@ ...@@ -122,10 +127,21 @@
}] }]
}; };
testHelper.create(echarts, 'main0', { var chart = testHelper.create(echarts, 'main0', {
title: [
'(1) Check legend click',
'(2) Check `progressiveChunkMode: "mod"` render correct',
'(3) Check snapshot rendering when "finished"'
],
option: option option: option
}); });
chart.on('finished', function () {
var url = chart.getDataURL();
var snapshotEl = document.getElementById('snapshot');
snapshotEl.src = url;
});
}); });
</script> </script>
</body> </body>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册