Different arrow line styles for state diagram?

0 votes
asked Aug 22, 2019 in Question / help by Dale Smith
Is is possible to to have different line styles for state diagrams?  Like for example, to highlight the "normal" / "common" / "expected" transitions?

1 Answer

0 votes
answered Aug 27, 2019 by Martin Cerny

Hello, you can colorize arrows.

state -direction[color]-> another_state : event

Usually I use this notation with explanation table in legend. See example:

@startuml                                                 
  skinparam legend {                                      
      BackgroundColor #White                              
      BorderColor     #White                              
  }                                                       

  'Colors Definitions                                     
  !define WAY1 #Black                                     
  !define WAY2 #LightGreen                                

  [*]    ->             StateA : Init                     
  StateA -[WAY1]->      StateB : ActionA                  
  StateB -right[WAY1]-> StateC : ActionB                  
  StateA -[WAY2]->      StateC : ActionC                  
 
  !define BGC(_color) <back:_color>                 </back>
  legend right                                            
    | Tr. color | meaning      |                          
    |BGC(WAY1)  | regular way  |                          
    |BGC(WAY2)  | faster way   |                          
  endlegend                                               
@enduml 
...