3
1

I am using the orthogonal layout:

    mxOrthogonalLayout orthoLayout = new mxOrthogonalLayout (graph);
    orthoLayout.execute (graph.getDefaultParent ());

However the edges are not orthogonal. How can I obtain orthogonal edges? There should be only right-angled bends in such an edge. I tried for example,

    graph.setCellStyle ("edgeStyle=mxEdgeStyle.EntityRelation");

but edges in diagonal are still shown.

asked 01 Apr '11, 01:41

testuser's gravatar image

testuser
3114
accept rate: 0%

edited 11 Oct '12, 07:24

David's gravatar image

David
4.9k21831


There's a new orthogonal edge style in the 1.6.1 release.

To use the orthogonal routing you set the edge style:

edgeStyle=orthogonalEdgeStyle

on the edges you require that routing for. Then for each vertex you can set the portConstraint style:

portConstraint=eastwestsouthnorth

removing the compass points as required. This will give you routing from just those direction for that routing. For example:

portConstraint=northsouth

will only connect the orthogonal edge style to that vertex in the vertical directions.

Note that this orthogonal edge style is the only edge style that accounts for the portConstraints on source and target vertices, no other edge style currently takes them into account.

link

answered 05 Apr '11, 13:22

David's gravatar image

David
4.9k21831
accept rate: 47%

edited 11 Oct '12, 07:25

Do I understand correctly and I don't need to specify a style for the edges? I mean just executing the orthogonal layout over the graph will show right-angled bends as edges?

(01 Apr '11, 02:33) testuser

No, this is an edge style, not a layout.

(05 Apr '11, 13:24) David

Its working perfectly. Can I mention the gap between two orthogonal edges which are coming from two different source vertices but to the same target vertex in anyway? I am using mxCompactTreeLayout.

(20 Apr '11, 02:24) harika

@harika, yes, the style needs a global awareness of other edges and vertices. We are designing and implementing this, but it's very complex, it will take some time.

(20 Apr '11, 02:31) David

Ok...I will wait for the solution. Thanks for the reply.

(20 Apr '11, 04:03) harika

No need to wait :-) This will set the default style for edges:

Map<String, Object> stil = new HashMap<String, Object>();
stil.put(mxConstants.STYLE_ROUNDED, true);
stil.put(mxConstants.STYLE_EDGE, mxConstants.EDGESTYLE_ENTITY_RELATION); // <-- This is what you want
stil.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_CONNECTOR);
stil.put(mxConstants.STYLE_ENDARROW, mxConstants.ARROW_CLASSIC);
stil.put(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE);
stil.put(mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER);
stil.put(mxConstants.STYLE_STROKECOLOR, "#6482B9");
stil.put(mxConstants.STYLE_FONTCOLOR, "#446299");

mxStylesheet foo = new mxStylesheet();
foo.setDefaultEdgeStyle(stil);
graph.setStylesheet(foo);
link

answered 05 Apr '11, 01:52

eisbaw's gravatar image

eisbaw
367112
accept rate: 31%

edited 11 Oct '12, 07:35

David's gravatar image

David
4.9k21831

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×100
×50
×28
×9
×4

Asked: 01 Apr '11, 01:41

Seen: 9,256 times

Last updated: 11 Oct '12, 07:35