3

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

1 Answer 1

3

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

3
  • 1
    Thank you, I was not aware of the << style >>! I notice that this breaks on multiline entries. Without style you can do :multi line; on two lines - I can't show it in comments - but with style, it does not work and you have to use the \n character and keep the entry on a single line.
    – GaspardP
    Commented May 2 at 13:56
  • 1
    @GaspardP You should provide that feedback to the developers (it's probably an easy fix). STYLE is a work in progress and this answer may even break in the future. Commented May 2 at 15:39
  • 1
    Awesome, the devs answered right away github.com/plantuml/plantuml/issues/1762 If you don't mind, I'll update your accepted answer with their feedback. Essentially, the <<dashedStyle>> should be after the action rather than before.
    – GaspardP
    Commented May 3 at 18:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.