Patryk Cholewa
Patryk Cholewa

Reputation: 103

PlantUML component diagam port

Is there any possible way to create component port in the component diagram?

If port has to be attached to only one arrow, its easy, because I can use #-- arrow.

interface y
[x] #- y

The problem is, if I try to attach to arrows to one port. I tried to use rectangle, but its not on the border then.

rectangle " " as P
[Component] - P

interface I1
interface I2

P - I1
P -- I2

Do you know any better workarounds?

Upvotes: 10

Views: 10244

Answers (2)

HaeschenaufGras
HaeschenaufGras

Reputation: 205

Although a bit late for TO perhaps helpful for someone else.

I managed to create ports on components with the following approach:

@startuml
skinparam componentstyle uml2
left to right direction

component X {
    port " " as x_out
}

'u for layouting it more nicely, 0) for lollipop
x_out -u0)- [Y]
x_out -u0)- [Z]

@enduml

However I experienced a bad layout of the port itself, means when a component has several ports it will start looking messy. But hey at least its a port with multiple connections.

Result looks like:

enter image description here

Upvotes: 9

Ștefan Fulea
Ștefan Fulea

Reputation: 1

I've managed to get a satisfactory result, at least in my case, this way:

@startuml
Interface -# MasterComponent
component MasterComponent {
[Subcomponent1] - [Subomponent2]
}
MasterComponent - [Subcomponent1]
@enduml

Upvotes: 0

Related Questions