Skip to content Skip to sidebar Skip to footer

How To Save An Entire State Of A Graph After Being Manipulated In Cytoscapejs

I am using cytoscapejs in angular, I want to the user to save a state of the graph after having done some manipulation (e.g panning, zooming, moving nodes and edges). I tried to

Solution 1:

Instead of saving the whole cy object, which didn't work, I extracted the nodes and edges(which also contains the x, y coordinates of each node which is all I needed) out of the cy object using.

let elements = {
   nodes: this.savedCyInstance.elements().nodes().jsons()
   edges: this.savedCyInstance.elements().edges().jsons()
}

and call the initialization code with the updated elements and layout name set to 'preset'


Post a Comment for "How To Save An Entire State Of A Graph After Being Manipulated In Cytoscapejs"