1

Greeatings! I'm using mxGraph and i impact with a problem. I need to create picture of created diagram on server. For this purposes i use default java servlet -java\examples\com\mxgraph\examples\web\ExportServlet.java It's create picture, but in some cases i got inverted colors and increased fonts. There is example of js code i use to send on server:

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
};

};

There is how diagram is looks like: Part of diagramm, as it is And there how diag look after export: Image of diag created by servlet Some colors are inverted and font is increased.

Is it bug or i go wrong somewhere?

SamirAD
  • 11
  • 3

0 Answers0