我尝试使用 plantuml 和 1 个组件在另一个组件中制作漂亮的图片,并带有一些内部和外部接口。在我的示例中,对象和文本重叠,输出很难看。
@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
这似乎是您正在使用的
left to right direction
配置的布局错误。也许您可以在 https://github.com/plantuml/plantuml/issues/ ? 向开发人员提出这个问题
一个解决方法(不太漂亮)是放置一个隐藏元素,导致布局发生变化。它占用顶部空间。
@startuml
left to right direction
' configure invis element
hide stereotype
skinparam interface {
bordercolor<<invis>> transparent
backgroundcolor<<invis>> transparent
}
component "component2" {
portin " " as pi1
portin " " as pi2
portout " " as po1
'the following is invisible
interface " " <<invis>>
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