I'm new to mxGraph. Does anyone know how to save a file to my local storage from mxGraph editor (http://jgraph.github.io/mxgraph/javascript/examples/grapheditor/www/index.html)? BTW, are XML files created with draw.io compatible with mxGraph? Thanks.
Use Codec and Encoder.
var encoder = new mxCodec();
var node = encoder.encode(graph.getModel());
variable node will have XML of your graph.
Use mxGraph utility to instantly show XML in popup.
mxUtils.popup(mxUtils.getPrettyXml(node), true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With