Several tips of plantuml

1. Frame diagram

1.1 You can use rectangle, component, etc. to draw a frame diagram, for example:

@startuml
skinparam componentStyle rectangle

[发现问题] as fx
[提出问题] as tc
[分析问题] as fenx
[归纳问题] as gl

fx-tc
tc-->fenx
fenx-gl

@enduml

The effect is as follows:

 1.2 Cards can also be used to draw frame diagrams. example:

@startuml

card 发现问题 as fx
card 提出问题 as tc
card 分析问题 as fenx
card 归纳问题 as gl
fx->tc
tc->fenx
fenx->gl

@enduml

Effect:

2. Control direction

2.1 By default, two dashes are used --to show a vertical line. To get a single dash in the horizontal direction, you can also change the direction by using keywords inside the arrow, for example left, , right, upor . downexample:

@startuml
' 水平方向
skinparam componentStyle rectangle

[发现问题] as fx
[提出问题] as tc
[分析问题] as fenx
[归纳问题] as gl

fx-tc
tc->fenx
fenx-gl

@enduml


@startuml
' 垂直方向
skinparam componentStyle rectangle

[发现问题] as fx
[提出问题] as tc
[分析问题] as fenx
[归纳问题] as gl

fx--tc
tc-->fenx
fenx--gl

@enduml

The effect is as shown in the figure:

 

 2.2 Use left, right, upor down, to change direction. example:

@startuml
skinparam componentStyle rectangle

[发现问题] as fx
[提出问题] as tc
[分析问题] as fenx
[归纳问题] as gl

fx-r-tc
tc-d->fenx
fenx-l-gl

@enduml

Effect:

2.3 Change the direction by left to right direction. example:

@startuml
skinparam componentStyle rectangle
left to right direction

[发现问题] as fx
[提出问题] as tc
[分析问题] as fenx
[归纳问题] as gl

fx--tc
tc-->fenx
fenx--gl

@enduml

 Effect:

 3. Set the straight line

In order to draw only horizontal or vertical lines, you can use skinparam linetype ortho.

To make all lines straight (but not necessarily horizontal or vertical), you can use skinparam linetype polyline.

4. Auxiliary layout

Syntax and functionality of class diagrams Syntax of PlantUML class diagrams: you can define interfaces, memberships, packages, generics, annotations... changing fonts and colors is also possible https://plantuml.com/zh-dark/class-diagram #c08f8d9927fcb626 Sometimes the default layout isn't perfect...

You can use togetherkeywords to group certain classes: the layout engine will try to bundle them together (as in a package), and you can also use linking hiddento force the layout. example:

@startuml
    class Bar1
    class Bar2
    together {
        class Together1
        class Together2
        class Together3
}

Together1 - Together2
Together2 - Together3
Together2 -[hidden]--> Bar1
Bar1 -[hidden]> Bar2

@enduml

 Effect:

Guess you like

Origin blog.csdn.net/wwwjr00/article/details/130415751