Class diagram vertical packages alignment

0 votes
asked 5 days ago in Question / help by Grolribasi (220 points)

Hello, I have a diagram that looks like this

I would prefer the last package to be right underneath the second one and the second one to be right underneath the first one. 

Left to right direction places the packages vertically to each other and mixes up the order of the class blocks in a package. 

How am I to force vertical alignment?

commented 5 days ago by Martin (5,640 points)

Yes, this is a pain.  For some reason Plantuml treats container shapes differently and tries to connect via the corners.  
Here's some ideas.
Making the arrows from client to server longer, will get the packages on different rows, but the horizontal alignment is screwy:

If you don't plan to link any of the inner boxes, then you can turn the container contents into sub-diagrams, so that the containers are no longer containers.  Also I had to remove your english aliases, as I don't think the package syntax supports title, alias, and description as three separate strings.

Finally you can use the Elk layout engine instead (I also tried the Smetana engine, but that didn't do the vertical layout for some reason), but it doesn't seem to support the colouring:

commented 4 days ago by Grolribasi (220 points)

Thanks for the ideas. I wasn't going to link the inner blocks so I tried to use the second diagram you proposed. It gave out an error, however :


commented 4 days ago by Grolribasi (220 points)

I solved the error by removing the line:

!pragma layout elk

Thanks for the solution, it is really helpful. 

commented 4 days ago by Martin (5,640 points)
Appologies for leaving that pragma in, I was trying lots of combinations.  Glad I could help.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.