提交 c326e50f 编写于 作者: L lang

空数据处理

上级 ee0824e7
Default Option
\ No newline at end of file
......@@ -20,6 +20,11 @@ define(function (require) {
data.diff(this.data)
.add(function (dataItem, idx) {
// 空数据
if (dataItem.getValue() == null) {
return;
}
var layout = dataItem.layout;
var normalItemStyle = dataItem.getModel('itemStyle.normal');
var rect = new api.Rect({
......@@ -47,6 +52,11 @@ define(function (require) {
.start('cubicOut');
})
.update(function (newData, oldData) {
// 空数据
if (newData.getValue() == null) {
group.remove(oldData.__el);
return;
}
// TODO DONT ANIMATE WHEN PROPERTIES ARE EQUAL
oldData.__el.animateShape()
.when(500, newData.layout)
......
......@@ -144,6 +144,13 @@ define(function(require) {
var coords = cartesian.dataToCoords(data);
lastStackCoords[stackId] = lastStackCoords[stackId] || [];
data.each(function (dataItem, dataIndex) {
var value = dataItem.getValue();
// 空数据
if (value == null) {
return;
}
var coord = coords[dataIndex];
var lastCoord = lastStackCoords[stackId][dataIndex] || projectAxis.otherCoord;
var x, y, width, height;
......
......@@ -61,6 +61,11 @@ define(function (require) {
* @return {number}
*/
dataToCoord: function (data, clamp) {
// PENDING
if (data == null || data === '-') {
return NaN;
}
data = this.scale.normalize(data);
return linearMap(data, [0, 1], this._coordExtent, clamp);
......
......@@ -255,7 +255,9 @@ define(function(require, factory) {
}
else {
data.eachValue(function (value) {
axisData[categoryAxis.dim == 'y' ? 'x' : 'y'].push(value);
if (value != null) {
axisData[categoryAxis.dim == 'y' ? 'x' : 'y'].push(value);
}
});
}
}
......
......@@ -119,12 +119,19 @@ define(function(require) {
* @return {number}
*/
getValue: function () {
var value;
// PENDING
// Value is a single number if data is 1d
if (this.dimension === 1) {
return this._value;
value = this._value;
}
return this._value[this.dimension];
else {
value = this._value[this.dimension];
}
if (value === '-') {
value = null;
}
return value;
},
/**
......
......@@ -67,8 +67,10 @@ define(function (require) {
setExtentFromData: function (data) {
var max = -Infinity;
var min = Infinity;
var i = 0;
for (; i < data.length; i++) {
for (var i = 0; i < data.length; i++) {
if (data[i] == null || data[i] === '-') {
continue;
}
max = Math.max(data[i], max);
min = Math.min(data[i], min);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册