Replace all elements and redraw graph softly in cytoscape.js
Asked Answered
W

1

7

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();
Willena answered 3/3, 2016 at 10:49 Comment(0)
I
26

Options:

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

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

Inveigle answered 3/3, 2016 at 15:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.