PlantUML文本绘图
PlantUML
的后缀格式为.puml
PlantUML
时序图
@startuml
hide footbox
title Sequence
actor User #Blue
User->A
note left: Note on left
[o->A: message
activate A
note right: 生命线
A->B: message
deactivate A
activate B
note right: Note on right
B-->A: message
deactivate B
activate A
A->A: message
activate A
deactivate A
deactivate A
A->o C
note right: 箭头样式
A-[#blue]>C
note right: 箭头颜色
alt AD
A->D: message
else DA
A->D: message
end
note over D #FFAAAA: 组合消息
D->E:message
note right: Creole和HTML
note right of E
This is **bold**
This is //italics//
This is ""monospaced""
This is --stroked--
This is __underlined__
This is ~~waved~~
end note
== 分隔符 ==
E->F: message
...
note over A:延迟
F->A:message
box "包裹参与者DEF" #LightBlue
participant D
participant E
participant F
end box
@enduml
效果图如下:
PlantUML
类图
@startuml
title 类
abstract class Abstract
interface Interface
package com.plantuml {
Abstract <|-- Class02:inherit
Class02 *-- Class03:contains
Class03 o-- Class04:aggregation
Class04 --|> Interface:inherit
Class01 : fun()
Class01 : String getString()
Class01 : void setString(String str)
}
class Dummy {
-field1
#field2
~method1()
+method2()
}
note right of Dummy
"可访问性"
"- private"
"# protected"
"~ package private"
"+ public"
end note
class Dummy2 {
{static} String id
{abstract} void methods()
}
note bottom of Dummy2
修饰符{static}或者{abstract}
end note
Dummy2 -> Dummy:link
note on link #blue:Dummy link Dummy2
@enduml
效果图如下:
参考:
[1] PlantUML : https://yebd1h.smartapps.cn/pages/blog/index?blogId=78673718&_swebfr=1&_swebFromHost=baiduboxapp
[2] PlantUML语法网站: https://plantuml.com/zh/