d2
d2 copied to clipboard
Dagre: child containers are pushed to the end
Inside the container the child containers are pushed to the end, but without container it render as expected from top. Can we change this behavior?
Example: {
User1: {
D1 -> D2 -> D3
}
User2: {
D1 -> D2 -> D3 -> D4 -> D5
}
}
Expected

Actual

Actually for ELK the same problem, but always centered :( I want to control this!
I found workaround for ELK
Examples: {
U1: User 1 {shape: person}
U1 -- D1 -> D2 -> D3
U2: User 2 {shape: person}
U2 -- D4 -> D5 -> D6 -> D7 -> D8
}

But it doesn't work for dagre
dagre does have an align property, but it has no effect when nodes are contained =\
https://github.com/terrastruct/d2/compare/master...alixander:d2:dagre-align?expand=1
unfortunately, nothing we can do except patch the code upstream. i'd make an issue, but they have a lot of open issues on this already for many years.
I wish I could specify the length of the connector.(https://github.com/terrastruct/d2/issues/920#issuecomment-1447150133)
https://play.d2lang.com/?l=&script=dNAxCsJAEIXhfk7xk97grNpMwGo9ggeIsFZKJEYILLm7ZFa2UZtXfbu8eae5vz9uycgC12G49KPRNGS_w5jSPHU4NbSjzGfoUj2bI69nGrWNamTv1X4mMrbfMPyDAuf1o9IGoq5PYvDcCVQSfhPPvefB-SLvAAAA__8%3D&