PlantUML 中的常用命令

了解 PlantUML 中普遍适用于所有图表类型的基本命令。这些命令允许您为图表注入多功能性和个性化细节。下面,我们将这些常用命令分为三大类:

全局元素

克里奥尔语法说明

利用克里奥尔语法的强大功能,进一步格式化图表中任何元素的内容* 。这种维基标记样式允许:

样式控制命令

使用style 命令完全控制图表元素的显示样式* 。利用它可以:

探索这些命令,创建功能和美观兼具的图表,根据您的具体要求定制每个元素。

注释

简单的注释

所有以simple quote ' 开始的都是一个 的注释。

@startuml
'Line comments use a single apostrophe
@enduml

</zh3> * 块状注释<zh3>

块状注释使用C风格的注释,除了用一撇一捺代替', 然后你也可以把注释放在几行上,用/' 开始,'/ 结束。

@startuml
/'
many lines comments
here
'/
@enduml

[Ref.QA-1353]

然后你也可以在同一行中放置块状注释,如。

[参考资料:QA-3906QA-3910] 。

[Ref. GH-214]

WARNING
 This translation need to be updated. 
WARNING

缩放

You can use the scale command to zoom the generated image.

You can use either a number or a fraction to define the scale factor. You can also specify either width or height (in pixel). And you can also give both width and height : the image is scaled to fit inside the specified dimension.

WARNING
 This translation need to be updated. 
WARNING

标题

使用 title 关键字添加标题。 你可以在标题描述中使用 \n 添加新行。

Some skinparam settings are available to put borders on the title.

You can use creole formatting in the title.

You can also define title on several lines using title and end title keywords.

图片标题

使用 caption 关键字在图像下放置一个标题.

页眉和页脚

你可以使用 headerfooter命令在生成的图中增加页眉和页脚。

你可以选择指定center, leftright关键字使页眉或页脚实现居中、左对齐和右对齐。

和标题一样,页眉或页脚内容可以在多行中定义,而且同样可以在页眉或页脚中输入一些HTML代码。

图例说明

legendend legend 作为关键词,用于配置一个图例(legend). 支持可选地使用left,right,center为这个图例指定对齐方式.

Appendix: Examples on all diagram

Activity

Archimate

Class

Component, Deployment, Use-Case

Gantt project planning

DONE
[(Header, footer) corrected on V1.2020.18]

Object

MindMap

Network (nwdiag)

Sequence

State

Timing

Work Breakdown Structure (WBS)

DONE
[Corrected on V1.2020.17]

Wireframe (SALT)

DONE
[Corrected on V1.2020.18]

Appendix: Examples on all diagram with style

DONE

FYI:
FIXME
🚩 To be fix; Thanks

FIXME

Here are tests of title, header, footer, caption or legend on all the diagram with the debug style:

<style>
title {
  HorizontalAlignment right
  FontSize 24
  FontColor blue
}

header {
  HorizontalAlignment center
  FontSize 26
  FontColor purple
}

footer {
  HorizontalAlignment left
  FontSize 28
  FontColor red
}

legend {
  FontSize 30
  BackGroundColor yellow
  Margin 30
  Padding 50
}

caption {
  FontSize 32
}
</style>

Activity

Archimate

Class

Component, Deployment, Use-Case

Gantt project planning

Object

MindMap

Network (nwdiag)

Sequence

State

Timing

Work Breakdown Structure (WBS)

Wireframe (SALT)

FIXME
Fix all (title, caption, legend, header, footer) for salt.
FIXME

Mainframe

[Ref. QA-4019 and Issue#148]

附录。所有图表上的主机实例

活动

架构

FIXME
栏目 在顶部和左侧进行了裁剪 FIXME

类别

FIXME
纪事 在顶部和左侧进行了裁剪 FIXME

组件、部署、用例

FIXME
丨 顶部和左侧的裁剪 FIXME### 丨

甘特项目计划

FIXME
Ì 在顶部和左侧进行了裁剪 FIXME

对象

FIXME
丨 顶部被裁剪! FIXME

心智图谱

网络 (nwdiag)

FIXME
锦标赛 顶部被裁剪! FIXME

序列

状况

FIXME
锦标赛 顶部和左侧被裁剪 FIXME

时间安排

工作分解结构(WBS)

线框 (SALT)

WARNING
 This translation need to be updated. 
WARNING

Appendix: Examples of title, header, footer, caption, legend and mainframe on all diagram

Activity

Archimate

Class

Component, Deployment, Use-Case

Gantt project planning

Object

MindMap

Network (nwdiag)

Sequence

State

Timing

Work Breakdown Structure (WBS)

Wireframe (SALT)