有没有办法在 PlantUML 组件图中包含一列元素?

Is there a way to have a single column of elements inside a PlantUML component diagram?

我正在尝试在单列上垂直对齐 PlantUML 组件图的元素。 我尝试了 "top o bottom direction" 和 "left to right direction" 选项,但没有很好的结果。 我发现的唯一方法是将每个元素包装在匿名 "frame" 中并设置 "left to right direction" 选项。 有没有办法避免这种情况?

作为一个相关问题,是否有文档解释元素如何与最终视图对齐,以及 "top to bottom" 和 "left to right" 应该如何工作?

非常感谢!

通过切换到 left to right direction 并使用 down 指示器,您可以垂直对齐所有组件而不依赖于它们。

@startuml
left to right direction
[a] -down-> [b]
[c] -down-> [d]
[e] -down-> [f]
@enduml

除此之外,您还可以使用 [hidden] 箭头进一步加强对象位置。 See "Help on layout" in the class diagram documentation.

@startuml
[x] -[hidden]down- [down]
[x] -[hidden]up- [up] 
[x] -[hidden]left- [left]
[x] -[hidden]right- [right]
@enduml

我认为除了您可以在 official docs, the forum and the source code 中找到的内容之外,没有更多的文档了。 PlantUML 的样式和定位功能有限。

如果您需要一些管理就绪的东西,可以考虑将图形导出为 SVG 并使用可以编辑矢量图形的工具对其进行编辑。 (即 Inkscape、Microsoft Visio、...)