How do I constrain the width of a class diagram?

0 votes
asked Dec 18, 2020 in Wanted features by Dave I
I have a class diagram that extends horizontally beyond the width of my largest monitor, but uses very little vertical space.  The packages, if stacked vertically rather than spread horizontally, would easily fit.  The image clips on the right edge, so it is not helpful to spread the window over two monitors.  How can I "encourage" plantuml to fit the diagram within the available window?
commented Dec 19, 2020 by Martin

With respect to the clipping - have you tried altering environment variable  PLANTUML_LIMIT_SIZE (see https://plantuml.com/faq#e689668a91b8d065 ) to increase the diagram size?

Stacking packages is tricky and frustrating.  You would expect to just be able to add hidden vertical dependencies between them, but if the top package contains more than one row then it prefers to connect from the side rather than the bottom and so adds unwanted horizontal space.  I've not found a good solution.

Vertical dependency (does save some horizontal space, but not much):

Adding a hidden dummy package on the far left can help:

Using sub-diagrams to reduce down to a single layer package can help, but it is quite restrictive and adds the unwanted outer box:

If anyone has better solutions, I too am interested.

1 Answer

0 votes
answered Dec 22, 2020 by The-Lu (64,340 points)

Hello D.,

You can put:

left to right direction

With that the align is vertical (but on the reverse order):


[See on PlantUML server]

See also similar issue here:

Regards,
Th.

...