Vertical alignment of text or label within a shape

0 votes
asked Jul 10, 2021 in Wanted features by 1derer (200 points)
edited Jul 10, 2021 by 1derer

Hi!

I tried to request this feature within the C4 library workstream (from stdlib) but it seems the core feature that would be needed for this isn't available in PlantUML yet. 

Would it be possible to align the label of the rectangle vertically in a way it could sit at least at the bottom of the box if needed? This is specially useful when nesting shapes and you want the label of the shape to be placed below the nested shape instead of on top.

This is the typical behavior:

PlantUML diagram

and this is what I would like to be able to do (sans the additional unwanted line breaks or void space):

PlantUML diagram

There are a couple of workarounds to get to something roughly similar, but none of those are clear/straightforward in terms of declaration nor it achieves the exact requirement, graphically speaking. Also, we need something simple that can be used in libraries that are going to be built upon basic PlantUML directives.

Whatever implementation would be great, but I think a nice way of defining it would be to add a modifier to the shape declaration. Maybe something like:

@startuml
rectangle "\bLABEL" {
   rectangle "nested\nrectangle" {
   }
}
@enduml

where the "\b" means "bottom" and it will place the label at the very bottom of the rectangle, regardless of other objects being nested inside the rectangle or not.

Not sure if "\l" already exists with the purpose of aligning the text horizontally to the left, but id it's there, the two should be compatible so they can be used together like this to achieve a bottom-left alignment:

@startuml
rectangle "\l\bLABEL" {
   rectangle "nested\nrectangle" {
   }
}
@enduml

I really don't know how PlantUML/GraphViz work at their core and if this can be done, but I believe it would be useful on all UML diagrams aside from C4. I'm using the rectangle shape as an example but it'd be great if it worked for all types of shapes.

Thanks!

commented Jul 10, 2021 by The-Lu (49,760 points)

Hello,
It seems to be a complement of this first request :

Regards,
Th.
commented Jul 21 by 1derer (200 points)
Yes, that´s correct. My first question (13419) went a bit unnoticed, but afterwards I also felt like I could be more specific and show some graphical examples to make the idea clearer.

Is there a way to take a look at this feature? I still think it would be very useful to have more control of nested object placement, both in PlantUML as well as for most of its standard libraries.

Thanks!

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.
...