MCPcopy
hub / github.com/apache/echarts / incrementalUpdate

Method incrementalUpdate

src/chart/helper/LargeLineDraw.ts:254–288  ·  view source on GitHub ↗
(
        taskParams: StageHandlerProgressParams,
        data: LargeLinesData,
        incrementalId: Displayable['incremental']
    )

Source from the content-addressed store, hash-verified

252 };
253
254 incrementalUpdate(
255 taskParams: StageHandlerProgressParams,
256 data: LargeLinesData,
257 incrementalId: Displayable['incremental']
258 ) {
259 const lastAdded = this._newAdded[0];
260 const linePoints = data.getLayout('linesPoints');
261
262 const oldSegs = lastAdded && lastAdded.shape.segs;
263
264 // Merging the exists. Each element has 1e4 points.
265 // Consider the performance balance between too much elements and too much points in one shape(may affect hover optimization)
266 if (oldSegs && oldSegs.length < 2e4) {
267 const oldLen = oldSegs.length;
268 const newSegs = new Float32Array(oldLen + linePoints.length);
269 // Concat two array
270 newSegs.set(oldSegs);
271 newSegs.set(linePoints, oldLen);
272 lastAdded.setShape({
273 segs: newSegs
274 });
275 }
276 else {
277 // Clear
278 this._newAdded = [];
279
280 const lineEl = this._create();
281 lineEl.incremental = incrementalId;
282 lineEl.setShape({
283 segs: linePoints
284 });
285 this._setCommon(lineEl, data);
286 lineEl.__startIndex = taskParams.start;
287 }
288 }
289
290 /**
291 * @override

Callers

nothing calls this directly

Calls 4

_createMethod · 0.95
_setCommonMethod · 0.95
setShapeMethod · 0.80
getLayoutMethod · 0.65

Tested by

no test coverage detected