d2 icon indicating copy to clipboard operation
d2 copied to clipboard

Dagre: child containers are pushed to the end

Open pleshevskiy opened this issue 2 years ago • 2 comments
trafficstars

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

image

Actual

image

pleshevskiy avatar Dec 01 '22 15:12 pleshevskiy

Actually for ELK the same problem, but always centered :( I want to control this!

pleshevskiy avatar Dec 01 '22 15:12 pleshevskiy

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
}

image

But it doesn't work for dagre

pleshevskiy avatar Dec 01 '22 16:12 pleshevskiy

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.

alixander avatar Dec 24 '22 22:12 alixander

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&

bo-ku-ra avatar Mar 03 '23 13:03 bo-ku-ra