Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use the curved edge style in mxGraph

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?

like image 727
Geff Attree Avatar asked Jan 17 '13 11:01

Geff Attree


2 Answers

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.

like image 177
Thomas the Tank Engine Avatar answered Sep 20 '22 05:09

Thomas the Tank Engine


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);
like image 44
Radim Burget Avatar answered Sep 19 '22 05:09

Radim Burget