Search code examples
plantuml

PlantUML port position in component diagram


Here is my code and how it is rendered

@startuml
skinparam componentStyle rectangle
component A1 {
   port P1
   [E1]
   [E2]
   [E1] -r-> [E2]
   [E2] -r-> P1
}
component A2 {
   port P2
   [E1] as e
   P2 -r-> e
}
P1 -r-> P2
@enduml

enter image description here

How to make P1 and P2 are on the vertical edges of A1 and A2 respectively? Thanks. enter image description here


Solution

  • Try with left to right direction and remove the explicit direction on the arrows.

    left to right direction
    
    skinparam componentStyle rectangle
    component A1 {
       port P1
       [E1]
       [E2]
       [E1] --> [E2]
       [E2] --> P1
    }
    component A2 {
       port P2
       [E1] as e
       P2 --> e
    }
    P1 --> P2