我用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
提交
取消