Greeatings! 我正在使用mxGraph而且我遇到了问题。我需要在服务器上创建创建图表的图片。为此,我使用默认的java servlet -java \ examples \ com \ mxgraph \ examples \ web \ ExportServlet.java 这是创建图片,但在某些情况下,我得到了反转的颜色和增加的字体。 我用来在服务器上发送的js代码示例:
EditorUi.prototype.getImageXML = function(){
var graph = this.editor.graph;
var bounds = graph.getGraphBounds();
var vs = graph.view.scale;
// Resuable image export instance
var imgExport = new mxImageExport();
// New image export
var xmlDoc = mxUtils.createXmlDocument();
var root = xmlDoc.createElement('output');
xmlDoc.appendChild(root);
// Renders graph. Offset will be multiplied with state's scale when painting state.
var xmlCanvas = new mxXmlCanvas2D(root);
xmlCanvas.translate(Math.floor(( - bounds.x) / vs), Math.floor(( - bounds.y) / vs));
xmlCanvas.scale(1 / vs);
imgExport.drawState(graph.getView().getState(graph.model.root), xmlCanvas);
// Puts request data together
var w = Math.ceil(bounds.width / vs + 2);
var h = Math.ceil(bounds.height / vs + 2);
return {
xml: encodeURIComponent(mxUtils.getXml(root)),
width: w,
height: h
};
};
图表如何显示: Part of diagramm, as it is 在出口后如何看待诊断: Image of diag created by servlet 某些颜色被反转,字体也会增加。
是错误还是我在哪里出错?