提交 e7e3cfe2 编写于 作者: S sushuang

remove stack from data API.

上级 bf0df088
...@@ -146,7 +146,7 @@ export default function (ecModel) { ...@@ -146,7 +146,7 @@ export default function (ecModel) {
return point; return point;
} }
}, true); });
}); });
} }
......
...@@ -108,7 +108,7 @@ export default function (seriesType, ecModel, api, payload) { ...@@ -108,7 +108,7 @@ export default function (seriesType, ecModel, api, payload) {
}); });
currentAngle = endAngle; currentAngle = endAngle;
}, true); });
// Some sector is constrained by minAngle // Some sector is constrained by minAngle
// Rest sectors needs recalculate angle // Rest sectors needs recalculate angle
......
...@@ -209,7 +209,7 @@ export function numCalculate(data, valueDataDim, type) { ...@@ -209,7 +209,7 @@ export function numCalculate(data, valueDataDim, type) {
sum += val; sum += val;
count++; count++;
} }
}, true); });
return sum / count; return sum / count;
} }
else { else {
......
...@@ -151,7 +151,7 @@ var ContinuousModel = VisualMapModel.extend({ ...@@ -151,7 +151,7 @@ var ContinuousModel = VisualMapModel.extend({
data.each(this.getDataDimension(data), function (value, dataIndex) { data.each(this.getDataDimension(data), function (value, dataIndex) {
range[0] <= value && value <= range[1] && dataIndices.push(dataIndex); range[0] <= value && value <= range[1] && dataIndices.push(dataIndex);
}, true, this); }, this);
result.push({seriesId: seriesModel.id, dataIndex: dataIndices}); result.push({seriesId: seriesModel.id, dataIndex: dataIndices});
}, this); }, this);
......
...@@ -265,7 +265,7 @@ var PiecewiseModel = VisualMapModel.extend({ ...@@ -265,7 +265,7 @@ var PiecewiseModel = VisualMapModel.extend({
// Should always base on model pieceList, because it is order sensitive. // Should always base on model pieceList, because it is order sensitive.
var pIdx = VisualMapping.findPieceIndex(value, this._pieceList); var pIdx = VisualMapping.findPieceIndex(value, this._pieceList);
pIdx === pieceIndex && dataIndices.push(dataIndex); pIdx === pieceIndex && dataIndices.push(dataIndex);
}, true, this); }, this);
result.push({seriesId: seriesModel.id, dataIndex: dataIndices}); result.push({seriesId: seriesModel.id, dataIndex: dataIndices});
}, this); }, this);
......
...@@ -75,7 +75,6 @@ function transferProperties(a, b) { ...@@ -75,7 +75,6 @@ function transferProperties(a, b) {
* Dimensions should be concrete names like x, y, z, lng, lat, angle, radius * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius
* Spetial fields: { * Spetial fields: {
* ordinalMeta: <module:echarts/data/OrdinalMeta> * ordinalMeta: <module:echarts/data/OrdinalMeta>
* stackable: <boolean>
* createInvertedIndices: <boolean> * createInvertedIndices: <boolean>
* } * }
* @param {module:echarts/model/Model} hostModel * @param {module:echarts/model/Model} hostModel
...@@ -844,7 +843,6 @@ listProto.setCalculationInfo = function (key, value) { ...@@ -844,7 +843,6 @@ listProto.setCalculationInfo = function (key, value) {
/** /**
* Get sum of data in one dimension * Get sum of data in one dimension
* @param {string} dim * @param {string} dim
* @param {boolean} stack
*/ */
listProto.getSum = function (dim /*, stack */) { listProto.getSum = function (dim /*, stack */) {
var dimData = this._storage[dim]; var dimData = this._storage[dim];
...@@ -967,11 +965,10 @@ listProto.indexOfRawIndex = function (rawIndex) { ...@@ -967,11 +965,10 @@ listProto.indexOfRawIndex = function (rawIndex) {
* Retreive the index of nearest value * Retreive the index of nearest value
* @param {string} dim * @param {string} dim
* @param {number} value * @param {number} value
* @param {boolean} stack If given value is after stacked
* @param {number} [maxDistance=Infinity] * @param {number} [maxDistance=Infinity]
* @return {Array.<number>} Considere multiple points has the same value. * @return {Array.<number>} Considere multiple points has the same value.
*/ */
listProto.indicesOfNearest = function (dim, value, /*, stack, */ maxDistance) { listProto.indicesOfNearest = function (dim, value, maxDistance) {
var storage = this._storage; var storage = this._storage;
var dimData = storage[dim]; var dimData = storage[dim];
var nearestIndices = []; var nearestIndices = [];
...@@ -1102,8 +1099,7 @@ function validateDimensions(list, dims) { ...@@ -1102,8 +1099,7 @@ function validateDimensions(list, dims) {
* list.each(['x', 'y'], function (x, y, idx) {}); * list.each(['x', 'y'], function (x, y, idx) {});
* list.each(function (idx) {}) * list.each(function (idx) {})
*/ */
// FIXME ???? remove stack listProto.each = function (dims, cb, context, contextCompat) {
listProto.each = function (dims, cb, stack, context) {
'use strict'; 'use strict';
if (!this._count) { if (!this._count) {
...@@ -1111,12 +1107,15 @@ listProto.each = function (dims, cb, stack, context) { ...@@ -1111,12 +1107,15 @@ listProto.each = function (dims, cb, stack, context) {
} }
if (typeof dims === 'function') { if (typeof dims === 'function') {
context = stack; contextCompat = context;
stack = cb; context = cb;
cb = dims; cb = dims;
dims = []; dims = [];
} }
// contextCompat just for compat echarts3
context = context || contextCompat || this;
dims = zrUtil.map(normalizeDimensions(dims), this.getDimension, this); dims = zrUtil.map(normalizeDimensions(dims), this.getDimension, this);
if (__DEV__) { if (__DEV__) {
...@@ -1125,8 +1124,6 @@ listProto.each = function (dims, cb, stack, context) { ...@@ -1125,8 +1124,6 @@ listProto.each = function (dims, cb, stack, context) {
var dimSize = dims.length; var dimSize = dims.length;
context = context || this;
for (var i = 0; i < this.count(); i++) { for (var i = 0; i < this.count(); i++) {
// Simple optimization // Simple optimization
switch (dimSize) { switch (dimSize) {
...@@ -1134,16 +1131,16 @@ listProto.each = function (dims, cb, stack, context) { ...@@ -1134,16 +1131,16 @@ listProto.each = function (dims, cb, stack, context) {
cb.call(context, i); cb.call(context, i);
break; break;
case 1: case 1:
cb.call(context, this.get(dims[0], i /*, stack */), i); cb.call(context, this.get(dims[0], i), i);
break; break;
case 2: case 2:
cb.call(context, this.get(dims[0], i /*, stack */), this.get(dims[1], i /*, stack */), i); cb.call(context, this.get(dims[0], i), this.get(dims[1], i), i);
break; break;
default: default:
var k = 0; var k = 0;
var value = []; var value = [];
for (; k < dimSize; k++) { for (; k < dimSize; k++) {
value[k] = this.get(dims[k], i /*, stack */); value[k] = this.get(dims[k], i);
} }
// Index // Index
value[k] = i; value[k] = i;
...@@ -1156,11 +1153,9 @@ listProto.each = function (dims, cb, stack, context) { ...@@ -1156,11 +1153,9 @@ listProto.each = function (dims, cb, stack, context) {
* Data filter * Data filter
* @param {string|Array.<string>} * @param {string|Array.<string>}
* @param {Function} cb * @param {Function} cb
* @param {boolean} [stack=false]
* @param {*} [context=this] * @param {*} [context=this]
*/ */
// ???? REMOVE STACK listProto.filterSelf = function (dimensions, cb, context, contextCompat) {
listProto.filterSelf = function (dimensions, cb, stack, context) {
'use strict'; 'use strict';
if (!this._count) { if (!this._count) {
...@@ -1168,14 +1163,14 @@ listProto.filterSelf = function (dimensions, cb, stack, context) { ...@@ -1168,14 +1163,14 @@ listProto.filterSelf = function (dimensions, cb, stack, context) {
} }
if (typeof dimensions === 'function') { if (typeof dimensions === 'function') {
context = stack; contextCompat = context;
stack = cb; context = cb;
cb = dimensions; cb = dimensions;
dimensions = []; dimensions = [];
} }
stack = stack || false;
context = context || this; // contextCompat just for compat echarts3
context = context || contextCompat || this;
dimensions = zrUtil.map( dimensions = zrUtil.map(
normalizeDimensions(dimensions), this.getDimension, this normalizeDimensions(dimensions), this.getDimension, this
...@@ -1203,13 +1198,11 @@ listProto.filterSelf = function (dimensions, cb, stack, context) { ...@@ -1203,13 +1198,11 @@ listProto.filterSelf = function (dimensions, cb, stack, context) {
keep = cb.call(context, i); keep = cb.call(context, i);
} }
else if (dimSize === 1) { else if (dimSize === 1) {
// var val = stack ? this.get(dim0, i, true) : this._getFast(dim0, rawIdx);
var val = this._getFast(dim0, rawIdx); var val = this._getFast(dim0, rawIdx);
keep = cb.call(context, val, i); keep = cb.call(context, val, i);
} }
else { else {
for (var k = 0; k < dimSize; k++) { for (var k = 0; k < dimSize; k++) {
// value[k] = stack ? this.get(dimensions[k], i, true) : this._getFast(dim0, rawIdx);
value[k] = this._getFast(dim0, rawIdx); value[k] = this._getFast(dim0, rawIdx);
} }
value[k] = i; value[k] = i;
...@@ -1360,25 +1353,26 @@ listProto.selectRange = function (range /*, stack */) { ...@@ -1360,25 +1353,26 @@ listProto.selectRange = function (range /*, stack */) {
* Data mapping to a plain array * Data mapping to a plain array
* @param {string|Array.<string>} [dimensions] * @param {string|Array.<string>} [dimensions]
* @param {Function} cb * @param {Function} cb
* @param {boolean} [stack=false]
* @param {*} [context=this] * @param {*} [context=this]
* @return {Array} * @return {Array}
*/ */
// ??? REMOVE STACK listProto.mapArray = function (dimensions, cb, context, contextCompat) {
listProto.mapArray = function (dimensions, cb, stack, context) {
'use strict'; 'use strict';
if (typeof dimensions === 'function') { if (typeof dimensions === 'function') {
context = stack; contextCompat = context;
stack = cb; context = cb;
cb = dimensions; cb = dimensions;
dimensions = []; dimensions = [];
} }
// contextCompat just for compat echarts3
context = context || contextCompat || this;
var result = []; var result = [];
this.each(dimensions, function () { this.each(dimensions, function () {
result.push(cb && cb.apply(this, arguments)); result.push(cb && cb.apply(this, arguments));
}, stack, context); }, context);
return result; return result;
}; };
...@@ -1429,14 +1423,15 @@ function getInitialExtent() { ...@@ -1429,14 +1423,15 @@ function getInitialExtent() {
* Data mapping to a new List with given dimensions * Data mapping to a new List with given dimensions
* @param {string|Array.<string>} dimensions * @param {string|Array.<string>} dimensions
* @param {Function} cb * @param {Function} cb
* @param {boolean} [stack=false]
* @param {*} [context=this] * @param {*} [context=this]
* @return {Array} * @return {Array}
*/ */
// ???? REMOVE STACK listProto.map = function (dimensions, cb, context, contextCompat) {
listProto.map = function (dimensions, cb, stack, context) {
'use strict'; 'use strict';
// contextCompat just for compat echarts3
context = context || contextCompat || this;
dimensions = zrUtil.map( dimensions = zrUtil.map(
normalizeDimensions(dimensions), this.getDimension, this normalizeDimensions(dimensions), this.getDimension, this
); );
......
...@@ -18,7 +18,7 @@ export default function (seriesType) { ...@@ -18,7 +18,7 @@ export default function (seriesType) {
} }
} }
return true; return true;
}, this); });
} }
}; };
} }
\ No newline at end of file
...@@ -115,10 +115,10 @@ export function applyVisual(stateList, visualMappings, data, getValueState, scop ...@@ -115,10 +115,10 @@ export function applyVisual(stateList, visualMappings, data, getValueState, scop
} }
if (dimension == null) { if (dimension == null) {
data.each(eachItem, true); data.each(eachItem);
} }
else { else {
data.each([dimension], eachItem, true); data.each([dimension], eachItem);
} }
function eachItem(valueOrIndex, index) { function eachItem(valueOrIndex, index) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册