Search code examples
umlplantuml

How to style a state in a PlantUML activity diagram (new syntax) for dashed or dotted outline


Is it possible to use a dashed or dotted stroke to outline a state of an activity diagram using PlantUML?

Not using the new activity diagram syntax, we can do a state diagram with styled outline, ex.

state State1
state State2 ##[dashed]
State1 -[dashed]-> State2

State diagram with dashed outline

Is there a way to style the outline of a state using the new syntax? This does not work:

:State1;
-[dashed]->
:State2; ##[dashed]

Activity diagram without dashed outline


Solution

  • State diagrams are not activity diagrams. A state is different than an activity.

    That said, you can do this with the <style> feature in PlantUML (not super well documented):

    @startuml
    <style>
    activityDiagram {
      .dashedStyle {
        LineStyle 4
      }
    }
    </style>
    :State1;
    -[dashed]->
    :State2;<<dashedStyle>>
    @enduml
    

    Activity diagram with dashed outline of one activity