MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / lineAnimationDiff

Function lineAnimationDiff

libs/echarts/echarts-en.simple.js:34119–34252  ·  view source on GitHub ↗
(
    oldData, newData,
    oldStackedOnPoints, newStackedOnPoints,
    oldCoordSys, newCoordSys,
    oldValueOrigin, newValueOrigin
)

Source from the content-addressed store, hash-verified

34117}
34118
34119var lineAnimationDiff = function (
34120 oldData, newData,
34121 oldStackedOnPoints, newStackedOnPoints,
34122 oldCoordSys, newCoordSys,
34123 oldValueOrigin, newValueOrigin
34124) {
34125 var diff = diffData(oldData, newData);
34126
34127 // var newIdList = newData.mapArray(newData.getId);
34128 // var oldIdList = oldData.mapArray(oldData.getId);
34129
34130 // convertToIntId(newIdList, oldIdList);
34131
34132 // // FIXME One data ?
34133 // diff = arrayDiff(oldIdList, newIdList);
34134
34135 var currPoints = [];
34136 var nextPoints = [];
34137 // Points for stacking base line
34138 var currStackedPoints = [];
34139 var nextStackedPoints = [];
34140
34141 var status = [];
34142 var sortedIndices = [];
34143 var rawIndices = [];
34144
34145 var newDataOldCoordInfo = prepareDataCoordInfo(oldCoordSys, newData, oldValueOrigin);
34146 var oldDataNewCoordInfo = prepareDataCoordInfo(newCoordSys, oldData, newValueOrigin);
34147
34148 for (var i = 0; i < diff.length; i++) {
34149 var diffItem = diff[i];
34150 var pointAdded = true;
34151
34152 // FIXME, animation is not so perfect when dataZoom window moves fast
34153 // Which is in case remvoing or add more than one data in the tail or head
34154 switch (diffItem.cmd) {
34155 case '=':
34156 var currentPt = oldData.getItemLayout(diffItem.idx);
34157 var nextPt = newData.getItemLayout(diffItem.idx1);
34158 // If previous data is NaN, use next point directly
34159 if (isNaN(currentPt[0]) || isNaN(currentPt[1])) {
34160 currentPt = nextPt.slice();
34161 }
34162 currPoints.push(currentPt);
34163 nextPoints.push(nextPt);
34164
34165 currStackedPoints.push(oldStackedOnPoints[diffItem.idx]);
34166 nextStackedPoints.push(newStackedOnPoints[diffItem.idx1]);
34167
34168 rawIndices.push(newData.getRawIndex(diffItem.idx1));
34169 break;
34170 case '+':
34171 var idx = diffItem.idx;
34172 currPoints.push(
34173 oldCoordSys.dataToPoint([
34174 newData.get(newDataOldCoordInfo.dataDimsForPoint[0], idx),
34175 newData.get(newDataOldCoordInfo.dataDimsForPoint[1], idx)
34176 ])

Callers 1

Calls 5

pushMethod · 0.80
diffDataFunction · 0.70
prepareDataCoordInfoFunction · 0.70
getStackedOnPointFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected