I would like to change the model of the current graph displayed.
With Java (JGraph) I can use graph.setModel(...) but there is no such method in JavaScript. What is the best way to do this ?
I would like to change the model of the current graph displayed.
With Java (JGraph) I can use graph.setModel(...) but there is no such method in JavaScript. What is the best way to do this ?
You can use graph.model directly
You can clear the graph by either calling
graph.removeCells(graph.getChildVertices(graph.getDefaultParent()));
or
graph.getModel().clear();
and setting a new model afterwards. In my experience, you have to additionally remove the html of the graph container, to truly erase all content (otherwise you get some weird white space in there).
$("#container").html("");