Skip to documentation content

Documentation · Process

Sequence diagram

Declare the participants across the top, then the messages in the order they are sent. The execution bars are read off the messages, so there is nothing to place.

Open Sequence diagram

When to use it

Explain interactions in time order between actors and objects, including replies and combined fragments.

Message order is the time axis. Execution bars are derived from calls and replies; do not try to place them as separate nodes.

Working example

Copy this complete example into the Source tab, then press Generate. Change its labels or values to make your first version.

Tingraph source
sequence "Shopping Cart" {
  actor CUST "Customer"
  object CART ":Shopping Cart"
  object ORDER ":Order"
  object ITEM ":Item"

  numbers on
  activations on

  CUST -> CART "«create»"
  CART -> ORDER "getTotal()"
  ORDER -> ITEM "getPrice()"
  ITEM --> ORDER "itemPrice"
  ORDER -> ORDER "calculateTotal()"
  ORDER --> CART "totalPrice"
}

Syntax reference

The same reference used by the editor and AI briefing. Syntax is notation-specific; use the keywords listed here.

Diagram

SyntaxMeaning
sequence "Title" {open a sequence diagram

Participants

SyntaxMeaning
object B ":Order"a named box over a lifeline
actor A "Customer"a stick figure
boundary S "Screen"what the outside world touches
control C "Handler"what runs the work
entity E "Account"what is stored
database D "Ledger"a store drawn as a drum

Messages

SyntaxMeaning
A -> B "call()"a call; opens an execution on B
A ->> B "signal()"asynchronous, open head
B --> A "answer"a reply; ends B's execution
create A -> B "new"B's lifeline starts here
destroy A -> B "close"B's lifeline ends with a cross
B -> B "check()"a call to itself, drawn as a loop

Fragments

SyntaxMeaning
alt "guard" { … }one section runs
} else "guard" { … }the next section of an alt
opt "guard" { … }runs only if the guard holds
loop "while" { … }runs again and again
par { … } and { … }the sections run alongside
break / criticalthe other two operators

Settings

SyntaxMeaning
numbers onnumber every message in order
activations offleave the execution bars off
style tintedformal, tinted or bold
colors colorfulor one colour: colors "#2a78d6"
spacing 150least room between two lifelines
step 46from one message down to the next
text 12caption size
size 700 420how big it is drawn

Language rules

  • The file is one sequence "Title" { ... } block.
  • Declare every participant before the messages, at the top level: object B ":Order".
  • Messages are written in the order they are sent, one per line, and that order is the diagram.
  • -> is a call, ->> is asynchronous, --> is a reply. create and destroy open a message line.
  • A fragment is a block: alt "guard" { ... } else "guard" { ... }. They may be nested.
  • The execution bars are worked out from the messages; never try to place them.

Edit on the canvas

  • Drag lifelines across the top to reorder participants. Select a message to move it within the sequence.
  • Edit the sequence through its figure controls rather than moving its internal strokes individually.

Generate replaces the drawing from source. Save before generating again if you want to preserve manual finishing touches.

Read Saving & exporting

Write it with an assistant

Tingraph AI already knows this notation. For another assistant, copy the tutorial below, describe your diagram under MY DIAGRAM, then paste the returned source into the editor. This prompt includes every syntax row, rule and working example above.

Read the complete prompt
You are writing Tingraph source. Tingraph is a small text language that draws a UML sequence diagram. Answer with Tingraph source only.

SYNTAX
Diagram
  sequence "Title" {          open a sequence diagram

Participants
  object B ":Order"           a named box over a lifeline
  actor A "Customer"          a stick figure
  boundary S "Screen"         what the outside world touches
  control C "Handler"         what runs the work
  entity E "Account"          what is stored
  database D "Ledger"         a store drawn as a drum

Messages
  A -> B "call()"             a call; opens an execution on B
  A ->> B "signal()"          asynchronous, open head
  B --> A "answer"            a reply; ends B's execution
  create A -> B "new"         B's lifeline starts here
  destroy A -> B "close"      B's lifeline ends with a cross
  B -> B "check()"            a call to itself, drawn as a loop

Fragments
  alt "guard" { … }           one section runs
  } else "guard" { … }        the next section of an alt
  opt "guard" { … }           runs only if the guard holds
  loop "while" { … }          runs again and again
  par { … } and { … }         the sections run alongside
  break / critical            the other two operators

Settings
  numbers on                  number every message in order
  activations off             leave the execution bars off
  style tinted                formal, tinted or bold
  colors colorful             or one colour: colors "#2a78d6"
  spacing 150                 least room between two lifelines
  step 46                     from one message down to the next
  text 12                     caption size
  size 700 420                how big it is drawn

RULES
- The file is one `sequence "Title" { ... }` block.
- Declare every participant before the messages, at the top level: `object B ":Order"`.
- Messages are written in the order they are sent, one per line, and that order is the diagram.
- `->` is a call, `->>` is asynchronous, `-->` is a reply. `create` and `destroy` open a message line.
- A fragment is a block: `alt "guard" { ... } else "guard" { ... }`. They may be nested.
- The execution bars are worked out from the messages; never try to place them.

WORKED EXAMPLE
sequence "Shopping Cart" {
  actor CUST "Customer"
  object CART ":Shopping Cart"
  object ORDER ":Order"
  object ITEM ":Item"

  numbers on
  activations on

  CUST -> CART "«create»"
  CART -> ORDER "getTotal()"
  ORDER -> ITEM "getPrice()"
  ITEM --> ORDER "itemPrice"
  ORDER -> ORDER "calculateTotal()"
  ORDER --> CART "totalPrice"
}

OUTPUT
- Reply with one fenced code block and nothing else.
- The block starts with `sequence "…" {` and ends with `}`.
- Do not invent keywords: use only the ones listed above.
- Keep labels short enough to read inside a box, and keep every ID unique.

MY DIAGRAM
Describe what you want here, then send this message.
How AI requests, attachments and privacy work

Something unclear? Contact support or read the Privacy Policy.