Replace all elements and redraw graph softly in cytoscape.js

让人想犯罪 __ 提交于 2020-01-24 06:14:45

问题


Is there any one-command way to replace all elements of my graph with new data in cytoscape.js? In my case, after some operations on backend I have new graph-data and want to redraw my graph with this new data, but not to lose my camera settings, maybe something like

cy.elements = my_elements;
cy.redraw();

回答1:


Options:

(1) cy.elements().remove(); cy.add( newEleJsons );

(2) cy.json({ elements: newEleJsons });



来源:https://stackoverflow.com/questions/35770055/replace-all-elements-and-redraw-graph-softly-in-cytoscape-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!