有谁知道如何将JGraphx导出为任何格式的图像?如果没有,那么有没有人知道任何其他java库,它将让我创建简单的图表,然后将其保存为图像?
Ian*_*nes 10
这应该用于PNG格式:
BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, Color.WHITE, true, null);
ImageIO.write(image, "PNG", new File("C:\\Temp\\graph.png"));
Run Code Online (Sandbox Code Playgroud)
哪里
graph是你的mxGraph对象.(注意mxCellRenderer是对类而不是变量的引用,因此mxCellRenderer.createBufferedImage是静态方法调用)."PNG"是格式,可以是JPEG,PNG,GIF,BMP和WBMP开箱即用.有关详细信息,请参见此处