nnako
nnako

Reputation: 141

place message text right of actor in PlantUML sequence diagram

BACKGROUND

An UML sequence diagram is commonly used to create a representation of messages sent between actors of a system, and thus clarifying the information flow. In general, messages are displayed between the communicating actors, which is a good practice and obviously appropriate for handling "messages".

MY APPLICATION

Now, I want to (mis)use sequence diagrams rather for clarifying which activity is performed on which actor, rather than which messages are sent between actors. Thus, I can e.g. describe the activity distribution within my system. I want to place text describing activities on the right of actors.

MY PROBLEM

When handling "Notes" in activity diagrams, PlantUML provides the possibility to freely place them around (left, right or in the center) of an actor, but I haven't figured out if this freedom was granted to messages as well.

Here is an example PlantUML sequence:

@startuml

' two activities executed on actor1

activate "actor1" #Olive
"actor1" -> "actor1": actor1 activity1\nactor1 summary1

' two sub-activities  executed on actor1

activate "actor1" #OliveDrab
"actor1" -> "actor2": actor1 sub-activity1\nactor1 sub-activity2

' then comes a transition from actor1 to actor2
' and two activities executed on actor2

activate "actor2" #Olive
"actor2" -> "actor1": actor2 func activity1\nactor2 func activity2

' two sub-activities executed on actor2

activate "actor2" #OliveDrab
"actor2" -> "actor2": actor2 func sub-activity1

@enduml

Which creates this result:

created by the PlantUML script above

Currently, the diagram has some other problems as well, but that shouldn't be an issue, here. I would just like to be able to place the "messages", which should be thought of "activities" in my case, on the right of each of the actors where they are created / initiated.

Here a principle picture how I could imagine the output:

enter image description here

I could try to use messages going from e.g. "actor2" to "actor2", but this always creates these reflexive arrows, which I don't really want to be seen in the diagram. And, I would like to stick to PlantUML for these kind of diagrams. Don't know if there was another kind of diagram to display "actors" and their "activities" in relation to each other.

Would this be possible?

Upvotes: 0

Views: 2870

Answers (1)

Jean-Marc Volle
Jean-Marc Volle

Reputation: 3333

You can always hide the arrows using white transparent color and create some "fake activations" It is a bit of a hack but I guess this would suite your request:

@startuml
A1 -[#ffffff00]> A1: 
activate A1
A1 -[#ffffff00]> A1: first activity of A1
A2 -[#ffffff00]> A2: 
activate A2
A2 -[#ffffff00]> A2: first activity of A2
A1 -[#ffffff00]> A1: 
activate A1 #blue
A1 -[#ffffff00]> A1: 2nd activity of A1
@enduml

enter image description here

Upvotes: 1

Related Questions