Hide element within another element

0 votes
asked Apr 26, 2022 in Bug by Niklas

When making diagrams it can be useful to create a high-level view with little detail to get a first grasp. Then when the basics have been described it would be useful to explain it with more details in another section, with a more detailed diagram to aid the explanation. For the purpose, I thought I can make a highly detailed diagram and just apply the "hide $tag" constructs to hide what's within the high-level blocks. However, it seems that this hides more than intended:

@startuml
rectangle "==Outer 1" as o1 $Level1 {
rectangle "==Outer 2" as o2 $Level2 {
rectangle "==Inner" as inner $Level3
}
}
rectangle "a" as a
rectangle "b" as b
a -> b

' This also hides $Level2!
hide $Level3
@enduml

Using this in my daily work and it would greatly easen my work, so I'm willing to chip in some EUR for this fix. Please let me know the rate and where to direct my thanks. :)

commented Apr 26, 2022 by The-Lu (64,340 points)

Hello N.,

See pseudo-similar issue/defect here:

Then, a workaround is to add dummy void element, as:

@startuml
rectangle "==Outer 1" as o1 $Level1 {
rectangle "==Outer 2" as o2 $Level2 {
[void]
remove void
rectangle "==Inner" as inner $Level3
}
}
rectangle "a" as a
rectangle "b" as b
a -> b

' This also hides $Level2!
hide $Level3
@enduml

@PlantUMLteam, see also those versions with defects:

similar issue with `remove`... :

@startuml
rectangle "==Outer 1" as o1 $Level1 {
rectangle "==Outer 2" as o2 $Level2 {
rectangle "==Inner" as inner $Level3
}
}
rectangle "a" as a
rectangle "b" as b
a -> b

' This hides all!!
remove $Level3
@enduml

And also:

@startuml
rectangle "==Outer 1" as o1 $Level1 {
rectangle "==Outer 2" as o2 $Level2 {
rectangle "==Inner" as inner $Level3 {
}
}
}
rectangle "a" as a
rectangle "b" as b
a -> b

' This hides nothing?
hide $Level3
@enduml

If that can help,
Regards,
Th.

commented Apr 27, 2022 by Niklas

Thanks! Your suggestions got me moving.

The workaround that I employ now is to add curly brackets on the inner component as well (I was using components all along but used rectangles when reporting), and using hidden stereotypes. Doing that, I get the expected behavior.

Example:

@startuml
component A <<$L1>> {
    component B <<$L2>> {
        component C <<$L3>> $L3 {
        }
    }
}

hide <<$L3>>
hide stereotype

@enduml

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