Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get perfectly centered lines using layered, interactive strategy? #1027

Open
donutdan4114 opened this issue Apr 17, 2024 · 11 comments
Open
Labels
bug Erroneous behaviour. easy-win This won't take long. question Request for support in using ELK.

Comments

@donutdan4114
Copy link

This is a very real example of how our elk is setup. I have tried to fix the layout to achieve a perfect look. I have tried most options, but not sure how most of them work.

Two issues, may or may not be related:

  1. The nodes end up off-center.
  2. The weird bend is the big problem. Sometimes I can fix the bend by not using INTERACTIVE, but not sure of other consequences to switching from that strategy.

I am sure I am missing something obvious with how I should even be thinking about the node setup.

p.s. Thank you everyone for this amazingly powerful tool. Truly a work of wonder that it can do all that it does!

2 1
@donutdan4114 donutdan4114 added the question Request for support in using ELK. label Apr 17, 2024
@soerendomroes
Copy link
Contributor

Try looking into nodePlacement.strategy. NETWORK_SIMPLEX as seen here might be what you want. But I think elk layered does currently not support the a node placement strategy that centers everything, maybe mrtree can do what you want.

@BCampbellDev
Copy link

Thanks @soerendomroes , I'm working on this with @donutdan4114 . I updated the nodes so that, when multiple edges leave a node, theres an "source" port for each, and when they converge on a node, that node has a matching number of 'target' ports - seems to help with one of the edge problems. There is still the issue of the middle path not being aligned.

I have tried switching back and forth between NETWORK_SIMPLEX and BRANDES_KOEPF - its seems that when using NETWORK_SIMPLEX the alignment is better, however the balancing we are going for is gone. If we use BRANDES_KOEPF , the balancing is better, but the alignment is off.

Not sure how to achieve the center alignment of NETWORK_SIMPLES with the balancing of BRANDES_KOEPF

Updated Model

@BCampbellDev
Copy link

Also ive found that when using BRANDES_KOEPF - if the farthest left node in the diagram, is made the width of the other nodes, 200, it solves the issue with the center line - not entirely sure why? lol maybe elk is working from left to right and thats the basis of the centering? so by making that node wider its pushing everything into a proper alignment?

@soerendomroes
Copy link
Contributor

@BCampbellDev Sadly, there is currently no option for this. BRANDES_KOEPF even with bk.fixedAlignment: BALANCED will only balance based on the whole graph and not locally since this does usually cost more space and drawings get bigger. NETWORK_SIMPLEX cannot be combined with BRANDES_KOEPF. Implementing a simple centering strategy node placement strategy is however on our agenda.

@soerendomroes
Copy link
Contributor

@BCampbellDev I will mark this as a bug and try to investigate this.

@soerendomroes soerendomroes added the bug Erroneous behaviour. label Apr 17, 2024
@soerendomroes soerendomroes added this to the Release 0.9.2 milestone Apr 17, 2024
@BCampbellDev
Copy link

thanks @soerendomroes

@BCampbellDev
Copy link

@soerendomroes I was able to find some success by regrouping and using parent nodes, and I think this is the direction I will head in. I do have one question about this I'm wondering if you or anyone else could shed light on

Model

Is there a way to top align the three nodes, N3A, N3B, N3C ?

@soerendomroes
Copy link
Contributor

@BCampbellDev Yes, by setting alignment for each node as documentated here and seen here.

@BCampbellDev
Copy link

Ah thank you @soerendomroes I will try that!

@BCampbellDev
Copy link

@soerendomroes perfect thank you so much

@BCampbellDev
Copy link

@soerendomroes would you have any thought on this one ? its slightly different so I created a new question for it

What is the best strategy / approach for balancing and aligning the contents of a node with the graph

@soerendomroes soerendomroes added the easy-win This won't take long. label Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Erroneous behaviour. easy-win This won't take long. question Request for support in using ELK.
Projects
None yet
Development

No branches or pull requests

3 participants