Reputation: 31
I am trying to evaluate if the rappid library will allow me to create my diagram, save it to JSON format and then re-load it from the same to view and edit later wihtout changing the layout. Any suggestions / tips from anyone who has used this library would be greatly appreciated. https://resources.jointjs.com/docs/jointjs/v1.1/joint.html#dia.Graph.JSON does not specify this https://www.jointjs.com/#Rappid-More-Info
Upvotes: 2
Views: 1122
Reputation: 1428
graph.fromJSON
/ graph.toJSON
is what you're looking for.
var jsonString = JSON.stringify(graph)
// ... send jsonString to the server,
// store it to the localStorage or do whatever you want
// ... later on
graph.fromJSON(JSON.parse(jsonString))
Upvotes: 2