plantuml

plantuml, how to avoid text or other objects overlapping?


I try to make nice picture with plantuml and 1 component inside another with some internal and external interfaces. Output is ugly with overlapping object and text in my example.

@startuml
left to right direction
component "component2" {
  portin " " as pi1
  portin " " as pi2
  portout " " as po1
  rectangle comp1
  pi1 --> comp1 
  pi2 --> comp1 
  comp1 --> po1
}

label "Interface1" as I1
label "Interface2" as I2
label "Interface3" as O3

I1 --> pi1
I2 --> pi2
po1 --> O3
@enduml

Output is: enter image description here


Solution

  • By trying to change the ranking of the elements using strategies from https://isgb.otago.ac.nz/infosci/mark.george/Wiki/wiki/PlantUML%20GraphViz%20Layout, I came up with:

    @startuml
    left to right direction
    
    component "component2" {
      portin " " as pi2
      portin " " as pi1
      portout " " as po1
      rectangle comp1
      pi1 -> comp1 
      pi2 -> comp1 
      comp1 -> po1
    }
    
    label "Interface2" as I2
    label "Interface1" as I1
    label "Interface3" as O3
    
    pi2 <-u- I2
    pi1 <-u- I1
    po1 --> O3
    @enduml
    

    image of refactored diagram