Stack artifacts vertically in component diagrams (portrait layout)

0 votes
asked Jan 21, 2021 in Question / help by Dominik
I would like to create a stack of component diagram artifacts, each in its own row. I try to force the alignment in rows via the arrow down --> functionality. In an example this works fine if there are only two nodes within the artifact, i.e., they use only one row. See http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuG9IcMc9oIKA9Va52jLS2Wfv-IcfOC8GcMF4LSk5K9kKNrAIduka75KzM0CApnY5PuB2CqNXcQ7mp55u5YWyIrJR3L2vXgXS8owG1q1-rDMrWxgVoo4rBmKO1W00

If I add a third node into the top artifact the layout is no longer stacked as desired http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuG9IcMc9oIKA9Va52jLS2Wfv-IcfOC8GcME4p37cgkL2Q4pABod9pqNIYwePLJTOEmhF18LdYi8pG-6Pe_0iK7YMgBORe78DKRb6N20FW3oigsi7TJ-NGsfU2Z100000

I tried to force an extent of the diagram by using the scale parameter, no success. My use case is to create diagrams that fit on a4 paper, but render them as svg first.

1 Answer

0 votes
answered Jan 22, 2021 by Martin (8,360 points)
edited Jan 22, 2021 by Martin
 
Best answer

Yes, this is a known short-coming of Plantuml that is really annoying.  As soon as a group has a second row, it wants to connect from the side instead of the bottom, and making good use of vertical space is hard.

Your example (click diagrams for online server code):

My 3 go-to strategies are:

1) Since the length of the arrow directly corresponds to the number of ranks the arrow is traversing, you can extend the arrow (as many times as needed) to drop down the second group.  It improves the diagram a little, but the second group is still horizontally offset for some reason:

2) Turn the groups into subdiagrams.  This means the groups are a single row and so connect perfectly.  But you can't interjoin between the subdiagrams.

3) Introduce a hidden group to the left and join to your groups.  The arrow still comes out of the side of the first group though.

Of course Plantuml is very versatile with lots of features that produce different results when combined, so somebody out there might have found a better method - I too am interested.

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

Also, a couple of 'left to right direction' versions to further expand the options:

...