2

I want to build something like this using PlantUML:

enter image description here

But I'm only able to build this:

enter image description here

This is my code:

@startuml
start
:Init;
fork
:Treatment 1;
fork again
:Treatment 2;
end fork
@enduml
Alexander Zeitler
  • 11,919
  • 11
  • 81
  • 124

4 Answers4

0

As far as I understand Activity Diagrams

  • you can parallelize things into swimlanes, but there's only one start
  • everything has to be in a swimlane (so I proposed "Control" as the start of your diagram)
  • PlantUML (and maybe UML in general) expects you to have a join after a fork (which again, I did in the "Control" lane):
@startuml
|Control|
:Init;
fork
|#AntiqueWhite|Swimlane1|
'start
:foo1;
'stop
fork again
|Swimlane2|
'start
:foo2;
:foo3;
'stop
|Control|
end fork
stop
@enduml

enter image description here

The PlantUML layout also isn't ideal, since the fork line stays only in the swimlane of the Control process.

Fuhrmanator
  • 11,459
  • 6
  • 62
  • 111
0

This is possible by combining an extra column for forking and hiding the start arrows:

enter image description here

@startuml
| | 
|a| Swim1
|b| Swim2
|c| Swim3
| |
fork
|a|
-[hidden]->
start
    if (A?) then (no)
        stop
    else (yes)
        if (B?) then (no)
            stop
        else (yes)
            :C;
        endif
    endif
stop
fork again
|b|
-[hidden]->
start
    :Process 2;
stop
fork again
|c|
-[hidden]->
start
    :Process 3;
stop
| |
end fork
@enduml
Mazzy
  • 1,901
  • 2
  • 16
  • 36
0

Would like to add

skinparam activityBarColor white
skinparam swimlaneBorderColor white

to Mazzy's answer, if you don't mind missing borders of the lanes and don't need additional forks in your diagram.

rendered

or invert the lane background color

rendered

-1

Not a complete solution but:

@startuml
start
:Init;
fork
start
:Treatment 1;
end
fork again
start
:Treatment 2;
end
end fork
@enduml

see also:

enter image description here

albert
  • 8,285
  • 3
  • 19
  • 32
  • At the downvoter. what is the reason (seen also the remark: "Not a complete solution" at the beginning of the answer)? – albert Nov 04 '18 at 17:27