eclipse / elk

Eclipse Layout Kernel - Automatic layout for Java applications.
https://www.eclipse.org/elk/
Other
258 stars 86 forks source link

Where can I find comprehensive java tutorial documentation?... #1028

Closed WYBupup closed 2 months ago

WYBupup commented 7 months ago

I am new to ELK, but even if I finished reading the documentation, I still have no idea how to solve my problem. Specifically, I want to use elk to compute the coordianates for my graph using graphviz dot layout algorithm.. Can anyone help point where the tutorial is?

soerendomroes commented 7 months ago

If I am not mistaken, you call ELK as specified here and set the algorithm to dot. You can find the supported dot options here. If you just want to call the algorithm, you can also try calling the GraphvizLayoutProvider directly.

Is there a specific thing that "dot" can do that "layered" cannot?

WYBupup commented 7 months ago

Thanks nfor your reply. Im now trying to layout my graph using TreeLayoutProvider. I want to span the tree from left to right and write the following code:

LayoutMetaDataService.getInstance().registerLayoutMetaDataProviders(
    new LayeredMetaDataProvider(),
    new MrTreeMetaDataProvider()
);

layoutProvider = new TreeLayoutProvider();

KNode graph = ....

graph.setProperty(CoreOptions.DIRECTION, Direction.RIGHT);

layoutProvider.layout(graph, new BasicProgressMonitor());

//draw graph

but I still get the tree which span from bottom to up.... (below) 六年级上册(微调后最新版,注意查看)_ 116300  6 百分数(一)

I think the problem may be graph.setProperty(CoreOptions.DIRECTION, Direction.RIGHT);

Can you guide me to fix it?

soerendomroes commented 7 months ago

The direction property was only introduced in ELK 0.9.X (although our documentation does currently not reflect that). Maybe this is the issue?

Are you sure that the top KNode graph is actually the parent of the other nodes? Sometimes there is a node in between.

soerendomroes commented 7 months ago

Oh, the documentation seems to be quite old. You should use the ElkNode that is actually available in ELK. The no longer used by ELK.

Eddykasp commented 5 months ago

The algorithm is working as expected here. The problem is simply that the coordinate system in the figure is the wrong way round. (0, 0) should be in the top-left corner and positive-y goes down instead of up.