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

Method _renderThumbnail

src/chart/graph/GraphView.ts:365–427  ·  view source on GitHub ↗
(
        seriesModel: GraphSeriesModel,
        api: ExtensionAPI,
        symbolDraw: SymbolDraw,
        lineDraw: LineDraw
    )

Source from the content-addressed store, hash-verified

363 }
364
365 private _renderThumbnail(
366 seriesModel: GraphSeriesModel,
367 api: ExtensionAPI,
368 symbolDraw: SymbolDraw,
369 lineDraw: LineDraw
370 ) {
371 const info = this._getThumbnailInfo();
372 if (!info) {
373 return;
374 }
375
376 const bridgeGroup = new graphic.Group();
377 const symbolNodes = symbolDraw.group.children();
378 const lineNodes = lineDraw.group.children();
379
380 const lineGroup = new graphic.Group();
381 const symbolGroup = new graphic.Group();
382 bridgeGroup.add(symbolGroup);
383 bridgeGroup.add(lineGroup);
384
385 // TODO: reuse elements for performance in large graph?
386 for (let i = 0; i < symbolNodes.length; i++) {
387 const node = symbolNodes[i];
388 const sub = (node as graphic.Group).children()[0];
389 const x = (node as Symbol).x;
390 const y = (node as Symbol).y;
391 const subShape = clone((sub as graphic.Path).shape);
392 const shape = extend(subShape, {
393 width: sub.scaleX,
394 height: sub.scaleY,
395 x: x - sub.scaleX / 2,
396 y: y - sub.scaleY / 2
397 });
398 const style = clone((sub as graphic.Path).style);
399 const subThumbnail = new (sub as any).constructor({
400 shape,
401 style,
402 z2: 151
403 });
404 symbolGroup.add(subThumbnail);
405 }
406
407 for (let i = 0; i < lineNodes.length; i++) {
408 const node = lineNodes[i];
409 const line = (node as graphic.Group).children()[0];
410 const style = clone((line as ECLinePath).style);
411 const shape = clone((line as ECLinePath).shape);
412 const lineThumbnail = new ECLinePath({
413 style,
414 shape,
415 z2: 151
416 });
417 lineGroup.add(lineThumbnail);
418 }
419
420 info.bridge.renderContent({
421 api,
422 roamType: seriesModel.get('roam'),

Callers 2

renderMethod · 0.95

Calls 7

_getThumbnailInfoMethod · 0.95
cloneFunction · 0.85
extendFunction · 0.85
renderContentMethod · 0.65
addMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected