Search code examples
layoutlabelconnectionplantuml

Plantuml connection alignment and layout problem


Working around on the deployment diagram for several hours, but still can't figure out how to align and format the lines and the labels of lines neatly. The following URL is a simple example of the deployment diagram

Questions

  1. The connection is tidier to point to the center of the both rectangles (as shown in red lines) other than the side and the edge of the rectangle, is there anyway to force the pointer to point to the center? enter image description here

  2. Can I align the label in parallel with the lines, plantUML align the label horizontally regardless of how the line draws, but it is tidier to let the label alongside with how the line is draw, is there any way / tricks can be used here to achieve? enter image description here

Appreciate for any help, thank you


Solution

    1. I used some ports to force the links to the top of the components, but it's probably not possible to get them perfectly in the center.
    2. As far as I know, it's not possible to have text labels follow the lines.
    @startuml
    
    skinparam componentstyle rectangle
    
    component componentA {
    }
    
    together {
    component "\nNested" as nested {
        port " " as p1
        component child1 [
            some very very very
            long content description
        ]
    }
    
    component "\nNested 2" as nested2 {
        port " " as p2
        component child2 [
            some very very very
            long content description
        ]
    }
    
    }
    
    componentA --> p1 : label 1
    componentA --> p2 : label 2
    
    @enduml
    

    enter image description here