我使用Antv/G6创建了一个图表,这个图表有一些工具提示。它正常工作。但是,如果我破坏并重新创建图形(请参阅下面的代码),图形将重新显示,但是工具提示将不再显示。任何想法都会受到极大的感谢,因为我目前对想法一无所知。
if (endpointsGraphCreated) {
endpointsGraph.destroy();
}
endpointsGraph = new G6.Graph(endpointConfiguration); // ERROR
endpointsGraphCreated = true;
// This element must be mounted before creating the graph
const data = { nodes: gNodes, edges: gEdges.slice(0) };
// endpointsGraph.data(data);
endpointsGraph.read(data); // combines data and render
}发布于 2021-12-10 14:30:45
我滥用毁灭()。我应该使用clear()代替,并确保不重新创建图形。预期的工作如下:
if (endpointsGraphCreated) {
// removes all nodes and edges. Leaves configuration intact
endpointsGraph.clear();
} else {
endpointsGraph = new G6.Graph(endpointConfiguration); // ERROR
endpointsGraphCreated = true;
}https://stackoverflow.com/questions/70284754
复制相似问题