Giacomo Cavallo
Giacomo Cavallo

Reputation: 43

How to update cytoscape.js graph during run time

I'm using cytoscape.js to render graphs in HTML page. The graph represent a RDF graph and the content is obtained by ajax request to REST service. This service allow to add/delete resource and statement, so i want to update the graph after each change.

I correctly configure cytoscape object when I receive the data but when I make some change to the rdf graph (add/delete resource) I'm not able to update the graph. For now I try this approaches:

My question is how i can update the elements of graph during run time without change style, position and other settings ?

Upvotes: 4

Views: 8309

Answers (1)

maxkfranz
maxkfranz

Reputation: 12242

Use eles.data() to (imperatively) modify dev-defined, per-element data: http://js.cytoscape.org/#eles.data

Use cy.json() if you want to specify mutations to the graph declaratively: http://js.cytoscape.org/#cy.json

Upvotes: 3

Related Questions