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

Function removeNode

src/chart/tree/TreeView.ts:643–683  ·  view source on GitHub ↗
(
    data: SeriesData,
    dataIndex: number,
    symbolEl: TreeSymbol,
    group: graphic.Group,
    seriesModel: TreeSeriesModel
)

Source from the content-addressed store, hash-verified

641}
642
643function removeNode(
644 data: SeriesData,
645 dataIndex: number,
646 symbolEl: TreeSymbol,
647 group: graphic.Group,
648 seriesModel: TreeSeriesModel
649) {
650 const node = data.tree.getNodeByDataIndex(dataIndex);
651 const virtualRoot = data.tree.root;
652
653 const { sourceLayout } = getSourceNode(virtualRoot, node);
654
655 // Use same duration and easing with update to have more consistent animation.
656 const removeAnimationOpt = {
657 duration: seriesModel.get('animationDurationUpdate') as number,
658 easing: seriesModel.get('animationEasingUpdate')
659 };
660
661 graphic.removeElement(symbolEl, {
662 x: sourceLayout.x + 1,
663 y: sourceLayout.y + 1
664 }, seriesModel, {
665 cb() {
666 group.remove(symbolEl);
667 data.setItemGraphicEl(dataIndex, null);
668 },
669 removeOpt: removeAnimationOpt
670 });
671
672 symbolEl.fadeOut(null, data.hostModel as TreeSeriesModel, {
673 fadeLabel: true,
674 animation: removeAnimationOpt
675 });
676
677 // remove edge as parent node
678 zrUtil.each(node.children, function (childNode) {
679 removeNodeEdge(childNode, data, group, seriesModel, removeAnimationOpt);
680 });
681 // remove edge as child node
682 removeNodeEdge(node, data, group, seriesModel, removeAnimationOpt);
683}
684
685function getEdgeShape(
686 layoutOpt: TreeSeriesOption['layout'],

Callers 2

doRenderNodeMethod · 0.85
renderMethod · 0.85

Calls 6

getSourceNodeFunction · 0.85
removeNodeEdgeFunction · 0.85
getNodeByDataIndexMethod · 0.80
fadeOutMethod · 0.65
getMethod · 0.45
eachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…