Use-Case Diagram: How to control alignment of use cases

0 votes
asked Jun 20, 2014 in To be sorted by markDavis (120 points)

Love Plant,

On use-case diagrams, I often have "high level context" diagrams that outline an overall system from a user perspective - these would list out the top level use cases at the system boundaries, and are really useful for top-level conversations.  In Plant, the easiest way to do them seems to be a Use Case diag (which is fine because each boils down to a UC diag anyhow).

In the layouts, I seem to have two options - "left to right direction" or "top to bottom direction".    I represent the system boundary as a rectangle.

My issue is the diagram doesn't make efficient use of space since it its organized in a single row or column - i.e. I can't make the "bubbles" line up in two rows.  E.g.

@startuml
title Top Level System Context Diagram
left to right direction
skinparam packageStyle rect
 
:User A: as A
:User B: as B
:User C: as C
rectangle "Marks amazing system" {
 
 
 A - (UC 1) 
 A - (UC 2)
 A - (UC 3)
 A - (UC 4)
 A - (UC 5)
 A - (UC 6)
 A - (UC 7)
 
 B -l- (UC 8)
 B -l- (UC 9)
 B -l- (UC 10)  
 
 C -l- (UC 11)
 C -l- (UC 12)
 C -l- (UC 13)
 C -l- (UC 14)  
}
 
@enduml

In this above diagram, is there any way to make UCs 8-14 appear to the right of UCs 1-7 for a more concise diagram?

commented Jun 20, 2014 by markDavis (120 points)
I'd also like to add that in the case below, I'd be happy if I could add contained rectangles that contain a subset of the cases with the facility to align those left or right of each other.  When I add rectangles they all seem  to stack top to bottom - doesn't appear to be a way of aligning.

1 Answer

+1 vote
answered Jun 20, 2014 by plantuml (295,000 points)

There is a trick, but we really don't like it, because it forces you to specify hidden links:

@startuml
title Top Level System Context Diagram
left to right direction
skinparam packageStyle rect
 
:User A: as A
:User B: as B
:User C: as C
rectangle "Marks amazing system" {
 
 
 A - (UC 1)
 A - (UC 2)
 A - (UC 3)
 A - (UC 4)
 A - (UC 5)
 A - (UC 6)
 A - (UC 7)
 
 B -l- (UC 8)
 B -l- (UC 9)
 B -l- (UC 10)  
 
 C -l- (UC 11)
 C -l- (UC 12)
 C -l- (UC 13)
 C -l- (UC 14)  
 
 (UC 1) -[hidden]- (UC 8)
 (UC 2) -[hidden]- (UC 9)
 (UC 3) -[hidden]- (UC 10)
 (UC 4) -[hidden]- (UC 11)
 (UC 5) -[hidden]- (UC 12)
 (UC 6) -[hidden]- (UC 13)
 (UC 7) -[hidden]- (UC 14)
}
@enduml

We will think about having a more "user friendly" way of having that...

commented Jun 23, 2014 by markDavis (120 points)
Great stuff - thanks a lot, works fine.  Possibly some way of adding items to containers (packages/rectangles) that can be aligned or linked and have optional visibility might be a more intuitive way..?
commented Mar 2, 2017 by Brancus (160 points)
Is that "user friendly" way already added in some way? it would really help me out.

thanks in advance for replying!
commented Mar 2, 2017 by plantuml (295,000 points)
No, we did not really made real progress here.
The only thing we have added is the "together" keyword that basically groups together elements (by drawing an invisible package).
So, keeping the initial example, you can also have:

@startuml
title Top Level System Context Diagram
left to right direction
skinparam packageStyle rect
 
:User A: as A
:User B: as B
:User C: as C
rectangle "Marks amazing system" {
together {
(UC 1)
(UC 2)
(UC 3)
(UC 4)
(UC 5)
(UC 6)
(UC 7)
}

together {
(UC 8)
(UC 9)
(UC 10)
(UC 11)
(UC 12)
(UC 13)
(UC 14)
}
(UC 1) -[hidden]- (UC 8)

 A - (UC 1)
 A - (UC 2)
 A - (UC 3)
 A - (UC 4)
 A - (UC 5)
 A - (UC 6)
 A - (UC 7)
 
 B -l- (UC 8)
 B -l- (UC 9)
 B -l- (UC 10)  
 
 C -l- (UC 11)
 C -l- (UC 12)
 C -l- (UC 13)
 C -l- (UC 14)  
 }
@enduml

Not sure that this is really more "user friendly", but it may be useful

http://www.plantuml.com/plantuml/uml/NP8zRuCm68Ht_ufJfcP0AXz9cqm1EhPJcgdgO0K7BC0W_BPg6kM_rs1Bc7gvUspV-HryqCG7-ceRHf8QWVUknwlu5WsELqsYHTuf4Z-45ydBWRUi4HS2THXaMH4AEOWpoKunNKlLStC3FJ_Nl1H7kfg-yPY1xKzQ34Ztu1gfesoYp54-KSx605UbYQxU-51hy9R_IbL2J_EiS6FKbO8gaxcnXrEES3r9P2MsabZPMDbQULgpE_iVVxPdEolXerFN6hhQqFM6oTXXdqNmKScY4EepW6j22kj3pqUUZpsVU7xZ-QtdpSXWo10qynipxHPaPWV6w_cyDSxXORJ4U8d9c3SBTtOGgZ2_uWy0
...