我用java做了一个图表,我想自定义它的风格。有什么简单的方法吗?通过为它们添加样式?以下是我使用的代码的一部分:它从json文件中获取一些数据,这些数据被填充到一些哈希图中。public mxGraphComponent createGlobalOverview(String Filename) { mxGraph graph = new mxGraph(); Object parent = graph.getDefaultParent(); graph.getModel().beginUpdate(); try { Object vRoot = graph.insertVertex(parent, null, Filename, 0, 0, 100, 50); int fmsCounter = 0; for (Object i : blueprint.keySet()) { getDependencies(i.toString()); if (blueprint.get(i).equals("FMS")) { if (dependsList.get(fmsCounter).equals("null")) { Object rootFMS = graph.insertVertex(parent, null, getTitle(i.toString()), 0, 0, 200, 50); graph.insertEdge(parent, null, "rootFMS", vRoot, rootFMS); System.out.println(blueprint.size()); createGraph(graph, parent, rootFMS, i, blueprint.size()); } } } graph.setCellsEditable(false); graph.setCellsMovable(false); graph.setCellsResizable(false); graph.setCellsSelectable(false); graph.setEnabled(false); mxIGraphLayout layout = new mxHierarchicalLayout(graph); layout.execute(parent); } finally { graph.getModel().endUpdate(); } graph.getView().setScale(0.9); mxGraphComponent graphComponent = new mxGraphComponent(graph); graphComponent.setConnectable(false); return graphComponent; }
添加回答
举报
0/150
提交
取消