提交 27a53dc2 编写于 作者: K kener

dataZoom重setOption fixed

上级 2430e602
......@@ -732,21 +732,19 @@ define(function (require) {
var length;
var data;
if (this._zoom.start > 0 || this._zoom.end < 100) {
for (var key in this._originalData) {
target = this._originalData[key];
for (var idx in target) {
data = target[idx];
length = data.length;
start = Math.floor(this._zoom.start / 100 * length);
end = Math.ceil(this._zoom.end / 100 * length);
if (this.option[key][idx].type != ecConfig.CHART_TYPE_SCATTER) {
this.option[key][idx].data = data.slice(start, end);
}
else {
// 散点图特殊处理
this.option[key][idx].data = this._synScatterData(idx, data);
}
for (var key in this._originalData) {
target = this._originalData[key];
for (var idx in target) {
data = target[idx];
length = data.length;
start = Math.floor(this._zoom.start / 100 * length);
end = Math.ceil(this._zoom.end / 100 * length);
if (this.option[key][idx].type != ecConfig.CHART_TYPE_SCATTER) {
this.option[key][idx].data = data.slice(start, end);
}
else {
// 散点图特殊处理
this.option[key][idx].data = this._synScatterData(idx, data);
}
}
}
......@@ -764,6 +762,13 @@ define(function (require) {
},
_synScatterData : function (seriesIndex, data) {
if (this._zoom.start == 0
&& this._zoom.end == 100
&& this._zoom.start2 == 0
&& this._zoom.end2 == 100
) {
return data;
}
var newData = [];
var scale = this._zoom.scatterMap[seriesIndex];
var total;
......@@ -1033,7 +1038,7 @@ define(function (require) {
this._location = this._getLocation();
// 缩放参数
this._zoom = this._getZoom();
if (this.option.dataZoom.show) {
if (this.option.dataZoom && this.option.dataZoom.show) {
this._buildShape();
}
this._syncData();
......
......@@ -549,34 +549,6 @@ define(function (require) {
return true; // 阻塞全局事件
},
_onDataZoom : function (param) {
var target = param.target;
if (this._zooming || this._zoomStart) {
// 取消
this._resetZoom();
this.zr.refresh();
this.dom.style.cursor = 'default';
}
else {
// 启用Zoom
this._resetMark(); // mark与dataZoom互斥
this.zr.modShape(target.id, {style: {strokeColor: this._enableColor}});
this.zr.refresh();
this._zoomStart = true;
var self = this;
setTimeout(function (){
self.zr
&& self.zr.on(zrConfig.EVENT.MOUSEDOWN, self._onmousedown)
&& self.zr.on(zrConfig.EVENT.MOUSEUP, self._onmouseup)
&& self.zr.on(zrConfig.EVENT.MOUSEMOVE, self._onmousemove);
}, 10);
this.dom.style.cursor = 'crosshair';
}
return true; // 阻塞全局事件
},
_onMarkUndo : function () {
if (this._marking) {
this._marking = false;
......@@ -612,6 +584,34 @@ define(function (require) {
return true;
},
_onDataZoom : function (param) {
var target = param.target;
if (this._zooming || this._zoomStart) {
// 取消
this._resetZoom();
this.zr.refresh();
this.dom.style.cursor = 'default';
}
else {
// 启用Zoom
this._resetMark(); // mark与dataZoom互斥
this.zr.modShape(target.id, {style: {strokeColor: this._enableColor}});
this.zr.refresh();
this._zoomStart = true;
var self = this;
setTimeout(function (){
self.zr
&& self.zr.on(zrConfig.EVENT.MOUSEDOWN, self._onmousedown)
&& self.zr.on(zrConfig.EVENT.MOUSEUP, self._onmouseup)
&& self.zr.on(zrConfig.EVENT.MOUSEMOVE, self._onmousemove);
}, 10);
this.dom.style.cursor = 'crosshair';
}
return true; // 阻塞全局事件
},
_onDataZoomReset : function () {
if (this._zooming) {
this._zooming = false;
......
......@@ -858,8 +858,15 @@ define(function (require) {
}
this._optionRestore = zrUtil.clone(this._option);
if (this.component.dataZoom && this._option.dataZoom) {
if (this.component.dataZoom // 存在dataZoom控件
&& (this._option.dataZoom // 并且新option也存在
|| (this._option.toolbox
&& this._option.toolbox.feature
&& this._option.toolbox.feature.dataZoom
&& this._option.toolbox.feature.dataZoom.show
)
)
) {
// dataZoom同步数据
this.component.dataZoom.syncOption(this._option);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册