Replies: 5 comments 3 replies
-
I'm not sure I'm entirely following what you're trying to do, but is there a reason that Admittedly, the fact that you can do this isn't well documented... |
Beta Was this translation helpful? Give feedback.
-
Yes, a dynamic one but always the same for all the nodes. What I would like is to be able to specify a different value per node, so for example all nodes have the same size but only one of them should be twice the size. |
Beta Was this translation helpful? Give feedback.
-
the API I referenced above does that. For example, if you wanted to make const specialNode = ...
const width = ...
const height = ...
const layout = sugiyama().nodeSize(node => node === specialNode ? [width * 2, height * 2] : [width, height]); |
Beta Was this translation helpful? Give feedback.
-
@erikbrinkman one additional question - is it possible to have sort of a node offset? What I mean is that the algorithm is probably calculating node position of its center. Can we somehow shift the node, so that its coordinates will be calculated for example for top left corner? Since nodes can expand and collapse, I will properly calculate their size depending on their state. So couple of questions:
Thank you! |
Beta Was this translation helpful? Give feedback.
-
Alright, nevermind. I have fixed it with a custom tweak, so that I don't have to copy and change all the code. It can produce not ideal layouts, if multiple expandable nodes would connect to one, but this is not the case in our app, so I don't mind that. The pseudocode for the tweak looks more or less like that:
This way nodes are shifted bottom and right for maximum space needed for one row / column. Seems to work so far. |
Beta Was this translation helpful? Give feedback.
-
Hi,
we are showing steps of a workflow in our software in form of a dag rendered with sugiyama algorithm. Graph is layered horizontal, but some of the steps has some nodes, that are not related to the whole flow, but step itself. They are rendered in vertical layout as a sort of sub-tree, and you can expand and collapse them.
Is it possible that this library would support dynamic size of a node? So that when it has those sub-nodes, we can calculate its size, that is different than the default one. And then, when user expands this sub-tree, size is recalculated and graph layout is redone? Of course we can call layout method again, that shouldn't be an issue, but the algorithm would need to be able to accept a different size per node?
Regards
Beta Was this translation helpful? Give feedback.
All reactions