Skip to content

Files

Latest commit

34d4f20 · Apr 23, 2020

History

History
131 lines (92 loc) · 2.79 KB

diagram-types.md

File metadata and controls

131 lines (92 loc) · 2.79 KB

Diagram Types

<-Home

PlantUML auto-detects the diagram type based on the first unique item in the code

Contents

Sequence Diagram
Use Case Diagram
Class Diagram
Activity Diagram

UNDER CONSTRUCTION

Sequence diagrams present ordered events that occur between participants (actors) over time (which runs top-to-bottom)

Here is a simple example:

@startuml
title Alice and Bob do a 3-Way TCP Handshake
Alice -> Bob: SYN
Bob --> Alice: SYN+ACK
Alice -> Bob: ACK
@enduml

Sequence Simple

There are multiple types of participant that can be used to trigger a sequence diagram, as per the types in the example below:

@startuml
title Sequence Participants
' Specify the participants left to right:
participant Participant
actor Actor
boundary Boundary
control Control
entity Entity
database Database
collections Collections
' Specify the events (in order):
group authentication
    Actor -> Boundary: Request Logon
    Boundary -> Actor: Provide Credentials
    Actor -> Boundary: username: actor, password: example123
    Boundary -> Actor: Accepted
end
Actor -> Boundary: List all options
Boundary -> Control: List all options (actor)
Control -> Entity: List all options (actor)
@enduml

Sequence Participants

The order that that participants is declared determines their order left to right in the diagram, and the order of the events is the order top to bottom

Another example showing setting colours etc:

@startuml

Title Another Sequence Diagram Example

skinparam ParticipantBackgroundColor SkyBlue
skinparam ParticipantBorderColor Black

' Set default colours for the horizontal arrows and vertical traces: 
skinparam sequence {
    ArrowColor blue
    LifeLineBorderColor black
}

' disable the bottom boxes for aesthetic reasons:
hide footbox 

' Set default colors for notes:
skinparam NoteBackgroundColor Yellow
skinparam NoteBorderColor black

' Participants:
participantAlice\nin\nWonderlandas alice
participantBob\n\nas bob
participantMad\nHatter\nas hatter


alice -> bob: what this means
note right: Written by Lewis Carroll

bob -[#red]> hatter: this arrow is red

hatter -[#black]> alice: This is all\nnonsense!
@enduml

Sequence Another Example

TBD

Auto detect use case diagram type by TBD

TBD

Auto detect class diagram type by use of line type:

  • <|--
  • *--
  • o--
  • ..
  • --

TBD

Auto detect activity diagram type by lines that start with : and end with ;