提交 a0f18b4e 编写于 作者: K kener

代码优化

上级 50de66ff
......@@ -1679,6 +1679,9 @@ var optionMap = {
var len = sData1.length;
var option = myChart.getOption();
option.series = option.series.slice(0,2);
option.legend = {
data : ['系列1', '系列2']
};
while (len--) {
option.series.push({
type: 'pie',
......@@ -1718,9 +1721,6 @@ var optionMap = {
trigger: 'item',
formatter: "{b} : {c} ({d}%)"
},
legend : {
data : ['系列1', '系列2']
},
toolbox: {
show : true,
feature : {
......
......@@ -40,17 +40,8 @@ define(function (require) {
};
self._setCurrentOption = function() {
self.currentIndex %= self.timelineOption.data.length;
//console.log(self.currentIndex);
// console.log(self.currentIndex);
var curOption = self.options[self.currentIndex] || {};
if (self.selectedMap) {
curOption.legend = curOption.legend || {};
curOption.legend.selected = self.selectedMap;
}
if (self.range) {
curOption.dataRange = curOption.dataRange || {};
curOption.dataRange.range = self.range;
}
self.myChart.setOption(curOption, self.timelineOption.notMerge);
self.messageCenter.dispatch(
ecConfig.EVENT.TIMELINE_CHANGED,
......@@ -124,9 +115,6 @@ define(function (require) {
this.ecTheme.animationDuration
);
}
this.selectedMap = false;
this.range = false;
}
Timeline.prototype = {
......@@ -722,17 +710,6 @@ define(function (require) {
this._syncHandleShape();
return;
},
/**
* 图例选择
*/
onlegendSelected : function (param) {
this.selectedMap = zrUtil.clone(param.selected);
},
ondataRange : function(param) {
this.range = zrUtil.clone(param.range);
},
last : function () {
this.timelineOption.autoPlay && this.stop(); // 停止自动播放
......
......@@ -868,8 +868,8 @@ define(function (require) {
},
// 重置备份还原状态等
reset : function (newOption, needClear) {
needClear && this.clear();
reset : function (newOption, isRestore) {
isRestore && this.clear();
if (this.query(newOption, 'toolbox.show')
&& this.query(newOption, 'toolbox.feature.magicType.show')
......@@ -913,7 +913,15 @@ define(function (require) {
}
}
}
this._magicType = {};
this._magicType = isRestore ? {} : (this._magicType || {});
for (itemName in this._magicType) {
if (this._magicType[itemName]) {
this.option = newOption;
this.getMagicOption();
break;
}
}
// 框选缩放
var zoomOption = newOption.dataZoom;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册