How do I use the curved edge style in mxGraph

天涯浪子 提交于 2021-01-27 05:45:54

问题


A recent release of mxGraph has added curves as a style for edges. I expected this to be an edge routing style, but it seems not. Could anyone show me a small example of a graph with curved edges?


回答1:


It's actually the shape style of the edge:

style = graph.getStylesheet().getDefaultEdgeStyle();
style[mxConstants.STYLE_CURVED] = '1';

Sets it for as the default for all edges.

Edge styles are really the positioning of the control points of the edge between the source and target. The curve isn't routing (this points positioning), it's just a styling through those points, thus it's not an edge style.




回答2:


In the current version you can use something like:

    mxGraph graph = new mxGraph();
    Map<String, Object> style = graph.getStylesheet().getDefaultEdgeStyle();
    style.put(mxConstants.STYLE_ROUNDED, true);
    style.put(mxConstants.STYLE_EDGE, mxConstants.EDGESTYLE_ENTITY_RELATION);


来源:https://stackoverflow.com/questions/14378514/how-do-i-use-the-curved-edge-style-in-mxgraph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!