亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

有沒有辦法從mxgraph更改頂點或邊緣樣式?

有沒有辦法從mxgraph更改頂點或邊緣樣式?

慕沐林林 2022-09-22 15:43:28
我用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; }
查看完整描述

1 回答

?
搖曳的薔薇

TA貢獻1793條經驗 獲得超6個贊

您可以使用 API 文檔mxStyleChange()

mxStyleChange(mxGraphModel graph, java.lang.Object cell, java.lang.String style)

要了解有關布局的更多信息,請在此處查看,這將幫助您定義樣式。這些形狀也可能很有用:

API文檔很廣泛,您應該始終查看那里。希望這對您有所幫助


查看完整回答
反對 回復 2022-09-22
  • 1 回答
  • 0 關注
  • 195 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號