vertically aligned columns of boxes in class diagram?

0 votes
asked Mar 19, 2021 in Question / help by m2spring (120 points)

Assuming this plantuml file:

@startuml
top to bottom direction
class Loooooooooooooooooooooong1
class Loooooooooooooooooooooong2
class Short1
class Short2

Loooooooooooooooooooooong1 -r- Loooooooooooooooooooooong2
Short1 -r- Short2
Loooooooooooooooooooooong1 -d- Short1
Loooooooooooooooooooooong2 -d- Short2
@enduml

I want to have 2 columns of vertically aligned boxes with properly straight edges.

See the diagrams here: https://imgur.com/a/m0iQ1wx

What am I missing?

Thanks!

(It's very unfortunate that I can't add the PNGs to my post -- I'm hitting a 8000 character limit.)

1 Answer

+1 vote
answered Apr 26, 2021 by anonymous
selected Apr 26, 2021 by m2spring
 
Best answer

You can add the green parameter:

@startuml
skinparam linetype ortho
top to bottom direction
class Loooooooooooooooooooooong1
class Loooooooooooooooooooooong2
class Short1
class Short2

Loooooooooooooooooooooong1 -r- Loooooooooooooooooooooong2
Short1 -r- Short2
Loooooooooooooooooooooong1 -d- Short1
Loooooooooooooooooooooong2 -d- Short2
@enduml

Here what you'll get 

Regards

commented Apr 26, 2021 by Martin (8,360 points)

Minor refinement to get closer to OP ideal, using 'norank' between Short1 and Short2.  This actually eliminates the need for the ortho linetype.

...