开发者

JGraphX - auto organise of cells and bidirectional edges

I am using JGraphX java library to visualise a graph model and overall it seems quite good. However, I am encountering 2 small problems.

1) Is there any possible way of having the nodes spread out in an automatic way and not defining explicity the location of where they are to be placed?

2) In the case where I have 2 edges (one from A to B, and one from B to A), is开发者_StackOverflow中文版 there any possible way where the user can select on of them only?

Thanks!


Ok I think i managed to find a solution to my question. I discovered the mxParallelEdgeLayout which makes both the edges visible. I am still looking for a good layout to display my graphs but there seems a number of these which might be enough to be used. A combination of the mxHierarchicalLayout and the mxParallelEdgeLayout seems to suite my purpose.

Example:

final mxGraphComponent graphComponent = new mxGraphComponent(trafficGraphVisual);
pnlGraphVisual.add(graphComponent, BorderLayout.CENTER);
new mxHierarchicalLayout(trafficGraphVisual).execute(trafficGraphVisual.getDefaultParent());
new mxParallelEdgeLayout(trafficGraphVisual).execute(trafficGraphVisual.getDefaultParent());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜