MCPcopy Index your code
hub / github.com/tdewolff/minify / lineAnimationDiff

Function lineAnimationDiff

_benchmarks/sample_echarts.js:41146–41252  ·  view source on GitHub ↗
(oldData, newData, oldStackedOnPoints, newStackedOnPoints, oldCoordSys, newCoordSys, oldValueOrigin, newValueOrigin)

Source from the content-addressed store, hash-verified

41144 }
41145
41146 function lineAnimationDiff(oldData, newData, oldStackedOnPoints, newStackedOnPoints, oldCoordSys, newCoordSys, oldValueOrigin, newValueOrigin) {
41147 var diff = diffData(oldData, newData); // let newIdList = newData.mapArray(newData.getId);
41148 // let oldIdList = oldData.mapArray(oldData.getId);
41149 // convertToIntId(newIdList, oldIdList);
41150 // // FIXME One data ?
41151 // diff = arrayDiff(oldIdList, newIdList);
41152
41153 var currPoints = [];
41154 var nextPoints = []; // Points for stacking base line
41155
41156 var currStackedPoints = [];
41157 var nextStackedPoints = [];
41158 var status = [];
41159 var sortedIndices = [];
41160 var rawIndices = [];
41161 var newDataOldCoordInfo = prepareDataCoordInfo(oldCoordSys, newData, oldValueOrigin);
41162 var oldDataNewCoordInfo = prepareDataCoordInfo(newCoordSys, oldData, newValueOrigin);
41163 var oldPoints = oldData.getLayout('points') || [];
41164 var newPoints = newData.getLayout('points') || [];
41165
41166 for (var i = 0; i < diff.length; i++) {
41167 var diffItem = diff[i];
41168 var pointAdded = true;
41169 var oldIdx2 = void 0;
41170 var newIdx2 = void 0; // FIXME, animation is not so perfect when dataZoom window moves fast
41171 // Which is in case remvoing or add more than one data in the tail or head
41172
41173 switch (diffItem.cmd) {
41174 case '=':
41175 oldIdx2 = diffItem.idx * 2;
41176 newIdx2 = diffItem.idx1 * 2;
41177 var currentX = oldPoints[oldIdx2];
41178 var currentY = oldPoints[oldIdx2 + 1];
41179 var nextX = newPoints[newIdx2];
41180 var nextY = newPoints[newIdx2 + 1]; // If previous data is NaN, use next point directly
41181
41182 if (isNaN(currentX) || isNaN(currentY)) {
41183 currentX = nextX;
41184 currentY = nextY;
41185 }
41186
41187 currPoints.push(currentX, currentY);
41188 nextPoints.push(nextX, nextY);
41189 currStackedPoints.push(oldStackedOnPoints[oldIdx2], oldStackedOnPoints[oldIdx2 + 1]);
41190 nextStackedPoints.push(newStackedOnPoints[newIdx2], newStackedOnPoints[newIdx2 + 1]);
41191 rawIndices.push(newData.getRawIndex(diffItem.idx1));
41192 break;
41193
41194 case '+':
41195 var newIdx = diffItem.idx;
41196 var newDataDimsForPoint = newDataOldCoordInfo.dataDimsForPoint;
41197 var oldPt = oldCoordSys.dataToPoint([newData.get(newDataDimsForPoint[0], newIdx), newData.get(newDataDimsForPoint[1], newIdx)]);
41198 newIdx2 = newIdx * 2;
41199 currPoints.push(oldPt[0], oldPt[1]);
41200 nextPoints.push(newPoints[newIdx2], newPoints[newIdx2 + 1]);
41201 var stackedOnPoint = getStackedOnPoint(newDataOldCoordInfo, oldCoordSys, newData, newIdx);
41202 currStackedPoints.push(stackedOnPoint[0], stackedOnPoint[1]);
41203 nextStackedPoints.push(newStackedOnPoints[newIdx2], newStackedOnPoints[newIdx2 + 1]);

Callers 1

sample_echarts.jsFile · 0.85

Calls 5

diffDataFunction · 0.85
prepareDataCoordInfoFunction · 0.85
isNaNFunction · 0.85
getStackedOnPointFunction · 0.85
createFloat32ArrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…