embed sub diagrams in diagram like a note

+3 votes
asked Jan 8, 2018 in Wanted features by glenflet

I want to be able to write something like this

@startuml

abstract ATest {
  {static} +String id
  {abstract} -void doit()
}

class Test {
  -int count
  -int max
  -int increment
  -void doit()
}

ATest <|-- Test

subdiagram right of  Test::doit
    start

    while (count < max?)
      :count = count + increment;
    endwhile
    
    stop
end subdiagram
@enduml

such that it would draw something like

image

but with the activity diagram

image

in the note rather than the code to define the activity diagram.

I would like this to work for any set of diagrams (in the start/end(uml) block) with unlimited levels of nesting, but am currently only looking to embed activity diagrams in class diagrams.

1 Answer

+3 votes
answered Jan 26, 2018 by Anthony-Gaudino (5,720 points)

You can do this:

@startuml
abstract ATest {
  {static} +String id
  {abstract} -void doit()
}

class Test {
  -int count
  -int max
  -int increment
  -void doit()
}

ATest <|-- Test

note right of Test::doit()
{{
    start

    while (count < max?)
      :count = count + increment;
    endwhile

    stop
}}
end note
@enduml

you may also embed a diagram as an image.

commented Jul 9, 2020 by Anonymous
Embedding in notes doesn't work with Mindmap and WBS diagrams, basically any diagrams that requires a @startX and @endX.
commented Jul 27, 2020 by The-Lu (63,920 points)

Hello A.,

Is it perhaps better to open a new Wanted features.
I can open it.

Regards,
Th.

...