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

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

Closed
BCampbellDev opened this issue Apr 23, 2024 · 5 comments
Labels
question Request for support in using ELK.

Comments

@BCampbellDev
Copy link

BCampbellDev commented Apr 23, 2024

Trying to create a link to the model errors so I am attaching the json.

scratch_548.json

So our goal is to center and balance the contents of the child nodes so that the edge leading to the hierarchy / wrapping node, would end at the center of the first child node.

The wrapping / parent nodes will not be shown to our users, so for our users, we want it to look like the edge leads to the first child node - same for the last child node and the edge leaving the wrapping / parent node.

Screenshot 2024-04-23 at 12 19 04 PM

Solutions we thought of:

  • Adjust the padding of each wrapping / parent node so the contents are centered against the edge targeting the wrapping / parent node
    OR
  • Use fixed positioning on the wrapping / parent node's in and out port to align them against the center of the first and last child nodes

Seems each approach has its own pros and cons. I've worked on the padding solution but run into some issues, so was hoping to get some feedback on what the best approach might be or alternative approaches.

Thanks in advance!

@soerendomroes
Copy link
Contributor

Hi, have you tried using a port (that looks like a node) with a fixed position instead? Currently, top node of the inner graph does not seem to be connected to the outside. If this produces bends, I suggest to add straightness priority to the edges that require it.

Adjusting the padding has the problem that this would change the size of a node, hence you would need to post process the drawing and adjust all node positions.

@BCampbellDev
Copy link
Author

@soerendomroes yes thats what im running into with the padding solution, finding i would need to run the layout when I make an adjustment.

I think what you are suggesting, and correct me if I am wrong, is the fixed positioned ports correct? So i would take the outer nodes in port, on the north side, and set its position fixed to where it would look centered against the first inner node?

@soerendomroes
Copy link
Contributor

Yes, but it has a similar problem that you need to know where the center actually is before you know how big the node might be.
Currently, I do not see that it is possible without doing more than one layout to calculate the size and then set position/padding based on that first calculation.

@BCampbellDev
Copy link
Author

agreed - thanks for your feedback - i will dive into the fixed positioned port solution :)

@BCampbellDev
Copy link
Author

@soerendomroes i tried that port solution, starting running into issues due to needing fixed position and the layout algorithm. Solution ended up being a lot simpler. I configured the model to be setup for hierarchy in a better way, by setting the hierarchy handling to include children and setting merge hierarchy edges to false - then I was able to set the edges to connect directly to the first inner node. Problem solved! lol thanks for all your help.

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

No branches or pull requests

2 participants