Is it possible to determine the nest level for rectangle?

0 votes
asked May 12, 2016 in To be sorted by programatix (120 points)


I would like to accomplish a drawing as below

Is it possible?

I tried the script below and it doesn't appear like I wanted it,

rectangle "Lvl1Block" #orange {
 rectangle "Lvl2Block1" #yellow
 rectangle "Lvl2Block2" #green {
  rectangle "Lvl3Block1" as RootDF #black {
   rectangle "Lvl4Block1" #lightblue{
    rectangle "Lvl5Block1"
    rectangle "Lvl5Block2"
   rectangle "Lvl4Block2" #lightblue
   rectangle "Lvl4Block3" #lightblue

1 Answer

0 votes
answered May 12, 2016 by plantuml (191,090 points)

Well, you can have

skinparam shadowing false
rectangle Box1 #lightblue

rectangle Box2 #lightblue {
 rectangle "<color:white>Child1" as Child1 #black
 rectangle "<color:white>Child2" as Child2 #black {
 rectangle N1 #red [
 rectangle N2 #red [

Is this close enough to what you are expecting ?

commented May 12, 2016 by programatix (120 points)
Thanks for the response.

However, is it possible to have

a) Box1 and Box2 to be of the same height
b) Child1 and Child2 to be of the same height
c) Box1 and Child1 to be bold
d) Reorder "#2 and #1" to "#1 and #2" in Child2.

Thanks in advance.
commented May 12, 2016 by plantuml (191,090 points)
a) and b) is not possible. We could think about adding some "min_width" and "min_height" option, but that would only be possible on final Rectangle (meaning Rectangle that does NOT contains other Rectangle). This would not been perfect through, because you would have to manually compute the value for those "min_width" and "min_height".

About c), you can use the <b> syntax

About d), the best option is to change order declaration of boxes (which is a bad solution)

The result is here:
commented May 12, 2016 by programatix (120 points)
edited May 12, 2016 by programatix
I tried using "\n" as workaround but it resulted in unaligned boxes.

I'm actually new to plantuml. What I'm trying to achieve here is to represent containers with their children/descendants each shown in correct level. It doesn't necessary be using "rectangle". Perhaps there is other way to represent this in plantuml?