Shift current time in sequence diagram

0 votes
asked Nov 18, 2021 in Wanted features by ryan0270 (120 points)

In the below diagram, I'd like a way to shift time so msg 3 is parallel to msg 1, msg 4 is parallel with msg 2, and message 5 is one row after msg 1

@startuml
!pragma teoz true

participant A
participant B
participant C
participant D
participant E

A -> B : msg 1
B -> C : msg 2

' Want to shift time up 2 rows
E -> D : msg 3
D -> D : msg 4
D -> C : msg 5
@enduml

PlantUML diagram

1 Answer

0 votes
answered Nov 18, 2021 by The-Lu (63,920 points)

Hello R.,

For that you can use `&`, as:

@startuml
!pragma teoz true

participant A
participant B
participant C
participant D
participant E

A -> B : msg 1
& E -> D : msg 3

B -> C : msg 2
& D -> D : msg 4
D -> C : msg 5
@enduml

See some help here:

If that can help,
Regards,
Th.

commented Nov 18, 2021 by ryan0270 (120 points)

I thought of that but it starts to get really difficult to read the text file b/c it needs to keep jumping between the A-B-C branch and the E-D-C branch; it's much easier to just define all of A-B-C in one area and then define all of E-D-C in another.

Using '&' also didn't seem to play well return statements. I can't figure out how to update your example to get the below to have the same alignments

@startuml
!pragma teoz true

participant A
participant B
participant C
participant D
participant E

activate A
A -> B++ : msg 1
  B -> C++ : msg 2
  return r2
return r1
deactivate A

' Want to shift time up 2 rows
activate E
E -> D++ : msg 3
  D -> D : msg 4
  D -> C++ : msg 5
  return r5
return r3
deactivate E
@enduml

PlantUML diagram

commented Nov 18, 2021 by The-Lu (63,920 points)

Ah.. you are right.. This is more hard in this case...
@Plantuml: have you a proposal?

...