[英]Converting XML to SVG in mxGraph javascript
对我有用的解决方案:
数据-表示mxGraphModel XML
var doc = mxUtils.parseXml(data); // parse XML into document
var graph = new Graph(container, null, null, null, null); // create Graph instance, container is an HTML element where the SVG will be exported
var outputSvg = graph.getSvg("#FFFFFF", 1, null, null, true, null, null);
最终输出是可以包含在HTML文档中的SVG对象:
document.getElementById('divForSvg').appendChild(outputSvg );
检查Graph.js及其getSvg()方法以获取详细信息。
搜索setGraphXml
的graphEditor示例中的setGraphXml函数(在Editor.js中)
这将读取xml并将其呈现在图形上
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.