Thursday, June 1, 2017

PlantUML Sequence Diagram

I made a sample sequence diagramAtom with PlantUML. Most frequently used rules are in this sample, so you should be able to make your own diagrams by modifying this sample if you forget the rules.

' Writes comments after singl quotaion mark.

@startuml

' Color Setting
skinparam actorBorderColor black
skinparam sequenceParticipantBorderColor black
skinparam sequenceLifeLineBorderColor black
skinparam sequenceArrowColor black
skinparam noteBorderColor black

' Declaire participants.
' You can define an alias usibg "as".
actor Actor as A
participant Participant as P

A -> P : Synchronous Message
activate P
A <<-- P : Return Message
deactivate P

A ->> P : Asynchronous Message
A -> A : Message to Self

' Note (For messages)
A -> P : Message
note right
 Note: note (left|right) ... end note
 (Or just "note (left|right) : ...")
end note
' Note (For participants)
note over A, P : note (left|rigght|over) of

' Text Decoration
A -> P : Multi Line\n(Line Break)
A -[#blue]> P : <font color="blue"><b>Change Style</b></font>

' Conditional Branch
alt guard condition
  A -> P : Message
else guard condition
  A -> P : Message
end

' "Message to Self" doesn't work with "Activate" well.
A ->> P : Asynchronous Message
activate P
P -> P : Message to Self
deactivate P

@enduml

Generated Diagram

http://www.plantuml.com/plantuml/png/ZLDTJnD157tVNt5J7qeJAUzDRRBmwaSZZ-h3T3kbQzSPd9t5aF3Wx2gsLW8nGTJW0o58XT0IJDH4g3zcM5YV-0lEJB4k7udTPAUxzvwUUy-vTxCWmwyosf2HEfjIz6JuNJ-7-pBQbQ5wtP7HeOmMzQbJspehkd7_ZHIxIUTzycjVYWyoR5lgoaBIEaWwUt7te-KtN3AB67e2oE6KJL9MnMoAUfH1nKDE8mNmyTC04mUN4UEkuyuYmaU1ttPhwYPu5ApD67rsFOHGVWs5qf9gHolkRYQTvsU7pTDrSRgw5I_takZexB2bWCYNOZjkRiKhIp9ygyIVzh-eY1HBsXSZ7snp8XziQ_OVRxg6JfOjouRn4fIX0DFpnAapIcZWmnti-sW6Qovt3d6iW3OKY-FZ1daVyu2H8QYAKp33Do2q_MiOJJbRPSy3m2bCOw-c3RYhd562ppDgtd6lByMQ59-rxc6ZVwcqaS3ScJgtp5yBnbeOyt2DBvXu3lBvF61IDHaBnkunU1pu739NaGMDpUIi8NhOpuMvNEWfE-Y1pc5b-4tJt4LYnRoWipcWHk79krVntbgo-VBtPZybAF2u2tgr7f8n_GEJ3AD6JYCUtAXu0Nuq01PhLCtDqMjpAwFZcLAnKfgg8wACdERp7YvEL4h52GqhcNgVDev_VekRY_71YeKy3ZC1ObN5GAekTocn0AxOYZqVZuGZLLtYqXpL9ssVRuCKdUCVhqzQRIcMu_RgyT6wCMv7YXV_svBKGfKlrHqkJ7hj_W00

No comments:

Post a Comment