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 align children top position on the same level? #279

Open
ranjabi opened this issue May 5, 2024 · 4 comments
Open

How to align children top position on the same level? #279

ranjabi opened this issue May 5, 2024 · 4 comments
Labels

Comments

@ranjabi
Copy link

ranjabi commented May 5, 2024

How to align children top position on the same level?

I'm currently using react flow with elkjs for the layouting as you can see below.
image

I tried to reproduce the equivalent in the ELKT editor below. The current layout is on the left side and the expected layout can seen on the right side of the image below. The nested nodes is represented by n2.
image
The following contrains are required:

  • nodes must be aligned on the same level on top position vertically (green dashed line)
  • nodes must be positioned below of all the nodes on the previous level (red dashed line)
  • nodes and its children must not takes spaces of its neighbor horizontally (blue dashed line)

Any node can be an average node or a nested node like n2 with varying children size.

Are these contrains can be achieved using elkjs? I already playing around but still not find the desirable config. Here my last config:

elk.algorithm: layered
elk.direction: DOWN
elk.spacing.nodeNode: 80
elk.hierarchyHandling: INCLUDE_CHILDREN
elk.layered.nodePlacement.strategy: NETWORK_SIMPLEX

Link to reproduce: ELKT

@Eddykasp
Copy link
Collaborator

Eddykasp commented May 6, 2024

The alignment property may help you (example).

@ranjabi
Copy link
Author

ranjabi commented May 6, 2024

The alignment property may help you (example).

Thank you it solved the first constraint, how about the third constraint where the nodes and its following children must not takes up its neighbors spaces horizontally?

@Eddykasp
Copy link
Collaborator

Eddykasp commented May 6, 2024

It sounds like you want an uncompacted tree layout. This is quite contrary to most typical aesthetics requirements and I don't think there is currently any way to produce such results directly in ELK. If you really insist that you want this you could add further children below n6 in your example so that you fill the tree and force the subtrees to separate that way. In your rendering you could then make the "dummy" nodes and edges invisible. Somewhat like this example.

@soerendomroes
Copy link
Member

@ranjabi You can set a compaction strategy as seen here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants