How to get perfectly centered lines using layered, interactive strategy?
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:
- The nodes end up off-center.
- 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!
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.
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
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?
@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.
@BCampbellDev I will mark this as a bug and try to investigate this.
thanks @soerendomroes
@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
Is there a way to top align the three nodes, N3A, N3B, N3C ?
Ah thank you @soerendomroes I will try that!
@soerendomroes perfect thank you so much
@soerendomroes would you have any thought on this one ? its slightly different so I created a new question for it