Skip to content

Sequence diagram manager ​

A sequence diagram shows one interaction step by step: who calls whom, in what order, with what. In Viaduct a sequence diagram is written in PlantUML and attached to a container or a component, and its participants are elements of the model around it. The sequence diagram manager is where you create, edit, check and export them.

Open the manager and create a diagram ​

The manager opened from Instruments, and a new diagram attached to a container.
  1. In the bar at the top left, open Instruments and choose Sequence Diagram.
  2. The manager opens. On the left is Diagrams, the list of every sequence diagram in the project, grouped by system and service. Until you pick one, the right side says what the editor is for.
  3. Press the plus on the Diagrams row at the top of the list (Add sequence diagram).
  4. Fill in the dialog:
    • Name: what the interaction is, for example "Checkout payment".
    • Attach: the container or component the diagram belongs to. Containers are listed under Containers and Databases, components under the name of their container. A sequence diagram cannot be attached to a system or to the project root.
  5. Press Create. The diagram opens in the editor and appears at the top of the list as Unsaved draft until you save it.

There are two more ways in, both from the canvas on the Containers or Components level:

  • Right-click a container or component and choose Add → Sequence diagram ("New PlantUML sequence bound to this element"). The dialog opens with the element already in Attach.
  • A block that has sequence diagrams shows a badge with their number. Click it for a panel with the element's diagrams; click one to open it.

The editor ​

The editor has a list and three columns. Each column can be hidden with the arrow in its header and brought back from the strip at the edge.

  • Diagrams: the list. It has a search field (Search sequence diagrams…) and a sort button: Recently updated, Recently created, Name A–Z, Name Z–A. A diagram somebody else is editing shows "Being edited by" and their name, and cannot be opened until they finish.
  • PlantUML: the source of the diagram, in a code editor with PlantUML highlighting. While you type a participant's name it offers the elements this diagram can use.
  • Preview: the diagram drawn from the source, with a toolbar above it and the diagnostics under it.
  • Properties: the fields of whatever is selected in the preview.

The source and the preview are one diagram. Whatever you change in one appears in the other at once.

Build the diagram ​

Participants from the model, messages in Properties or in PlantUML, a diagnostic, export.

Participants ​

Press Add from C4 model, the first button of the preview's toolbar. The list shows the elements this diagram can use:

  • for a diagram attached to a container: its system, the other containers of that system (databases separately) and the container's own components;
  • for a diagram attached to a component: its system, its container and the other components of that container.

Elements already on the diagram are not repeated; when all are there, the list says "All related C4 elements are already on the diagram". Click an element to add its lifeline. Drag a participant's box sideways to change the order.

Select a participant to see in Properties:

FieldWhat it is
NameThe label on the box. It starts as the element's name.
IDThe participant's PlantUML alias, used in messages. It cannot be changed here.
KindHow the box is drawn: actor, participant, boundary, control, entity, database, queue or collections. Elements from the model get a suitable kind, for example database for a database.

Messages ​

There are two ways to add a message:

  • Press Add message in the toolbar. It adds a message from the first participant to the second, with the text "message".
  • Drag from the dot on one participant's box to another participant.

Select a message (click its arrow) to edit it in Properties:

FieldWhat it is
From, ToThe sender and the receiver.
TextThe label on the arrow, for example POST /api/payments.
ArrowThe PlantUML arrow: -> (call), --> (dashed), ->> and -->> (open head), ->x and -->x (lost message).
ActivateStarts an activation bar: on the receiver (target ++) or on the sender.
DeactivateEnds one: on the receiver (target --) or on the sender.

A message written as a return in PlantUML is shown as Return, with its text only. Wrap in expand puts the selected message into a group; the group has a Name, can be collapsed with Hide messages and Show messages, and is removed with Unwrap expand. In PlantUML a group is written group Label … end.

Notes and dividers ​

  • Note adds a note over the selected or the first participant. In Properties choose its Position (over, left or right), its participant and its text.
  • Divider adds a section separator, written == … == in PlantUML. A Delay (...) can be written in the source. Both have only their text.

Editing, undoing, deleting ​

  • Undo and Redo in the toolbar step through your changes.
  • Delete or Backspace removes what is selected. Right-clicking a message, a participant or a group opens a menu with its actions, including delete.
  • The slider at the bottom left of the preview zooms; the button next to it fits the diagram in view.

You can also do all of this by typing PlantUML in the left column. Constructs the preview cannot show yet are kept in the source and listed as warnings.

Check it against the model ​

Under the preview, the diagnostics list what is wrong with the source, each with its line and column, for example L7:8 [warning]. The line is marked in the PlantUML column too. With nothing to report it says "No diagnostics".

Besides PlantUML mistakes (a missing @startuml or @enduml, an arrow without a target, a fragment without end), the diagnostics check the diagram against the model:

  • A message to a name that is not declared creates a participant anyway, with the warning "Implicit participant … created from message reference". This is usually a typo, or an element that should be picked from the model.
  • A participant declared with a name that is not among the elements this diagram can use is reported as "not in the C4 model for this diagram". Pick it with Add from C4 model, or with the autocomplete in the PlantUML column.

Export ​

The last button of the toolbar, Export, offers:

  • PlantUML: downloads the .puml source.
  • PNG: a bitmap image, rendered on the server.
  • SVG: a vector image, rendered on the server.

Save ​

Press the save button (the disk icon) in the editor's bar. It is active when there are changes and the diagram is attached to an element; an unattached diagram cannot be saved. The bar also shows who changed the diagram last and when.

If you close the editor or switch to another diagram with unsaved changes, the editor asks first: Discard and close, or Cancel to go back.

Managing diagrams ​

Hover a diagram in the list to see its buttons: Rename, Move diagram (attach it to another container or component) and Delete. Deleting asks for confirmation; Ctrl/⌘+Z undoes it.

A sequence diagram can also be shown inside a documentation page, with Insert → Insert sequence: see Project documentation.