Graphviz: Difference between revisions
Jump to navigation
Jump to search
(→Test) |
|||
| (275 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
= Test = | |||
<quickgv name="N" theme="warm"> | |||
rankdir=BT; | |||
skcom_dll [label="SKCOM.dll"]; | |||
skcom_py [label="AsyncQuoteReceiver"]; | |||
eq [label="Event Queue"]; | |||
hq [label="History Queue"]; | |||
websockets [label="Websockets\n(ws://127.0.0.1:8080)"]; | |||
frontend [label="Frontend"]; | |||
skcom_dll -> skcom_py; | |||
skcom_py -> eq; | |||
eq -> hq [label="backup", constraint=false]; | |||
eq -> websockets; | |||
hq -> websockets; | |||
websockets -> frontend; | |||
frontend -> websockets; | |||
</quickgv> | |||
= Beautify Edges = | = Beautify Edges = | ||
== OTP == | |||
<quickgv name="otp" theme="warm"> | |||
rankdir=TB; | |||
A [label="接到衛生所的電話"]; | |||
B [label="配合(不確定是不是)衛生所的人加入 Line 好友"]; | |||
C [label="電話中詢問對方分機"]; | |||
D [label="掛掉對方打來的電話, 照衛生所官網提供的號碼,\n主動打去衛生所與分機"]; | |||
E1 [label="隨機給對方一組數字,\n請他在 Line 裡面輸入"]; | |||
E2 [label="對方要求打去指定的電話號碼"]; | |||
F1 [label="輸入正確"]; | |||
F2 [label="輸入錯誤"]; | |||
F3 [label="輸入錯誤3次"]; | |||
G [label="身分核對完成"]; | |||
H [label="視為詐騙"]; | |||
A -> B -> C -> D; | |||
D -> E1; | |||
D -> E2; | |||
E1 -> {F1 F2 F3}; | |||
F2 -> E1; | |||
F1 -> G; | |||
E2 -> H; | |||
F3 -> H; | |||
</quickgv> | |||
== Record shape == | |||
https://graphviz.org/doc/info/shapes.html#record | |||
<quickgv name="test0" theme="warm" usage="ram"> | |||
rankdir=TB; | |||
spline=ortho; | |||
FW [label="{Vigor 2926 | { <1> P1 | <2> P2 | <3> P3 | <4> P4 | <w1> WAN1 | <w2> WAN2 }}"]; | |||
Hinet [label="種花電信肛世代"]; | |||
Office [label="office switch"] | |||
FW:w1 -> Hinet; | |||
FW:1 -> Office; | |||
</quickgv> | |||
== Order == | |||
<quickgv name="gds_order" theme="warm"> | |||
rankdir=TB; | |||
subgraph cluster_common { | |||
label="共用流程2"; | |||
A [label="收到下訂請求"]; | |||
B [label="檢查價格與庫存"]; | |||
C [label="排程更新價格與庫存"]; | |||
D1 [label="進入 JTR 專用流程"]; | |||
D2 [label="進入 TKM 專用流程"]; | |||
D3 [label="進入 BMG 專用流程"]; | |||
} | |||
subgraph cluster_jtr { | |||
label="JTR 專用流程"; | |||
E1 [label="下訂"]; | |||
E2 [label="同步訂單資訊"]; | |||
E3 [label="付款"]; | |||
} | |||
subgraph cluster_tkm { | |||
label="TKM 專用流程"; | |||
F1 [label="TODO"]; | |||
} | |||
subgraph cluster_bmg { | |||
label="BMG 專用流程"; | |||
G1 [label="TODO"]; | |||
} | |||
Z1 [label="完成訂單"]; | |||
Z2 [label="下訂失敗"]; | |||
A -> B; | |||
B -> C [xlabel="錯誤",color="#f00000"]; | |||
B -> {D1 D2 D3} [xlabel="正確"]; | |||
C -> Z2; | |||
D1 -> E1 -> E2 -> E3 -> Z1; | |||
D2 -> F1; | |||
D3 -> G1; | |||
E1 -> Z2 [color="#f00000"]; | |||
E3 -> Z2 [color="#f00000"]; | |||
</quickgv> | |||
== GDS == | |||
<quickgv name="GDS" theme="warm"> | |||
rankdir=TB; | |||
A [label="[Product]\nUniversal Studios Singapore E-ticket"]; | |||
B1 [label="[Type]\nAdult"]; | |||
B2 [label="[Type]\nChildren"]; | |||
B3 [label="[Type]\nInfant"]; | |||
C1 [label="[Price]\n2019-03-08\n99.61 SGD"]; | |||
C2 [label="[Price]\n2019-03-09\n105.99 SGD"]; | |||
C3 [label="[Price]\n2019-03-08\n80.50 SGD"]; | |||
C4 [label="[Price]\n2019-03-09\n95.12 SGD"]; | |||
C5 [label="[Price]\n2019-03-08\n35.20 SGD"]; | |||
C6 [label="[Price]\n2019-03-09\n49.99 SGD"]; | |||
A -> { B1 B2 B3 }; | |||
B1 -> { C1 C2 }; | |||
B2 -> { C3 C4 }; | |||
B3 -> { C5 C6 }; | |||
</quickgv> | |||
== Edge Attributes == | == Edge Attributes == | ||
| Line 55: | Line 185: | ||
== Edge label == | == Edge label == | ||
=== All kinds of labels === | === All kinds of labels === | ||
<quickgv name=" | {| class="wikitable" | ||
! label || xlabel || headlabel || taillabel | |||
|- | |||
| | |||
<quickgv name="G1_1" theme="warm"> | |||
rankdir=TB; | rankdir=TB; | ||
A -> B [label="label"]; | |||
</quickgv> | </quickgv> | ||
| | |||
<quickgv name="G1_2" theme="warm"> | |||
rankdir=TB; | |||
A -> B [xlabel="xlabel"]; | |||
</quickgv> | |||
| | |||
<quickgv name="G1_3" theme="warm"> | |||
rankdir=TB; | |||
A -> B [headlabel="headlabel"]; | |||
</quickgv> | |||
| | |||
<quickgv name="G1_4" theme="warm"> | |||
rankdir=TB; | |||
A -> B [taillabel="taillabel"]; | |||
</quickgv> | |||
|} | |||
=== Difference between label and xlabel=== | === Difference between label and xlabel 1 === | ||
Attribute label works not good as expected while using in subgraph. | Attribute label works not good as expected while using in subgraph. | ||
{| class="wikitable" | {| class="wikitable" | ||
| Line 69: | Line 216: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
<quickgv name=" | <quickgv name="G2_1" theme="warm"> | ||
rankdir=TB; | rankdir=TB; | ||
A -> B [label="label"]; | A -> B [label="label"]; | ||
</quickgv> | </quickgv> | ||
| valign="top" | | | valign="top" | | ||
<quickgv name=" | <quickgv name="G2_2" theme="warm"> | ||
rankdir=TB; | rankdir=TB; | ||
A -> B [xlabel="xlabel"]; | A -> B [xlabel="xlabel"]; | ||
</quickgv> | </quickgv> | ||
| valign="top" | | | valign="top" | | ||
<quickgv name=" | <quickgv name="G2_3" theme="warm"> | ||
rankdir=TB; | rankdir=TB; | ||
subgraph cluster_subg { | subgraph cluster_subg { | ||
| Line 86: | Line 233: | ||
</quickgv> | </quickgv> | ||
| valign="top" | | | valign="top" | | ||
<quickgv name=" | <quickgv name="G2_4" theme="warm"> | ||
rankdir=TB; | rankdir=TB; | ||
subgraph cluster_subg { | subgraph cluster_subg { | ||
| Line 94: | Line 241: | ||
|} | |} | ||
=== | === Difference between label and xlabel 2 (constraint=false) === | ||
<quickgv name=" | * The label is gone. | ||
* Space of xlabel is not enough. | |||
{| class="wikitable" | |||
! label | |||
| | |||
<quickgv name="G3_1" theme="warm"> | |||
rankdir=TB; | |||
A1 -> B1 [label="label", constraint=false]; | |||
</quickgv> | |||
|- | |||
! xlabel | |||
| | |||
<quickgv name="G3_2" theme="warm"> | |||
rankdir=TB; | |||
A1 -> B1 [xlabel="xlabel", constraint=false]; | |||
</quickgv> | |||
|- | |||
! xlabel<br/>with minlen=4 | |||
| | |||
<quickgv name="G3_3" theme="warm"> | |||
rankdir=TB; | |||
A1 -> B1 [xlabel="xlabel", minlen=4, constraint=false]; | |||
</quickgv> | |||
|- | |||
! label<br/>in subgraph | |||
| | |||
<quickgv name="G3_4" theme="warm"> | |||
rankdir=TB; | |||
subgraph cluster_subg { | |||
A1 -> B1 [label="label", constraint=false]; | |||
} | |||
</quickgv> | |||
|- | |||
! xlabel<br/>in subgraph | |||
| | |||
<quickgv name="G3_5" theme="warm"> | |||
rankdir=TB; | rankdir=TB; | ||
subgraph cluster_subg { | subgraph cluster_subg { | ||
A1 -> B1 [xlabel="xlabel", constraint=false]; | |||
} | |||
</quickgv> | |||
|- | |||
! xlabel<br/>in subgraph<br/>with minlen=4 | |||
| | |||
<quickgv name="G3_6" theme="warm"> | |||
rankdir=TB; | |||
subgraph cluster_subg { | |||
A1 -> B1 [xlabel="xlabel", minlen=4, constraint=false]; | |||
} | |||
</quickgv> | |||
|} | |||
=== Direction of subgraph === | |||
<quickgv name="LS4" theme="warm"> | |||
rankdir=TB; | |||
newrank=true; | |||
subgraph cluster_home { | |||
label="Home"; | |||
rank="same"; | |||
A [label="browser https://www.google.com"]; | |||
B [label="sudo socat ... udp4-recvfrom:53 ..."]; | |||
} | } | ||
subgraph cluster_office { | |||
label="Office"; | |||
subgraph cluster_dns { | |||
label="DNS"; | |||
C [label="ssh -NCfR 1053: ..."]; | |||
D [label="socat ... tcp4-listen ..."]; | |||
E [label="DNS Server"]; | |||
} | |||
subgraph cluster_http { | |||
label="HTTP"; | |||
F [label="ssh -NCfR 3128: ..."]; | |||
G [label="ssh -NCfD ..."]; | |||
H [label="HTTP Server"]; | |||
} | |||
} | |||
// DNS Routing | |||
A:e -> B:w [xlabel="1. udp",color="#ff0000",minlen=4]; | |||
B:e -> C:e [xlabel="2. ssh",color="#ff0000"]; | |||
C:se -> D:ne [xlabel="3. tcp",color="#ff0000",arrowtail="dot"]; | |||
D:se -> E:ne [xlabel="4. udp",color="#ff0000"]; | |||
E:nw -> D:sw [xlabel="5. udp",color="#0000ff"]; | |||
D:nw -> C:sw [xlabel="6. tcp",color="#0000ff"]; | |||
C:nw -> B:sw [xlabel="7. ssh",color="#0000ff"]; | |||
B:w -> A:e [xlabel="8. udp",color="#0000ff",constraint=false]; | |||
// SOCKS Routing | |||
A -> F [xlabel="9. ssh",color="#ff0000",labelfloat=true,labeldistance=200.0]; | |||
F -> G [xlabel="10. socks",color="#ff0000"]; | |||
G -> H [xlabel="11. tcp",color="#ff0000"]; | |||
H -> G [xlabel="12. tcp",color="#0000ff"]; | |||
G -> F [xlabel="13. socks",color="#0000ff"]; | |||
F -> A [xlabel="14. ssh",color="#0000ff"]; | |||
</quickgv> | |||
=== Position of xlabel === | |||
<quickgv name="poxl" theme="warm"> | |||
rankdir=BT; | |||
splines=ortho; | |||
A -> B [dir=both,color="#ff0000:#0000ff"]; | |||
</quickgv> | </quickgv> | ||
Latest revision as of 06:03, 7 June 2021
Test
Beautify Edges
OTP
Record shape
https://graphviz.org/doc/info/shapes.html#record
Order
GDS
Edge Attributes
| label | arrow | other |
|---|---|---|
|
arrowhead arrowsize arrowtail color colorscheme comment constraint decorate dir fillcolor fontcolor fontname fontsize id len lhead ltail minlen nojustify penwidth pos samehead sametail showboxes target tooltip weight
Edge label
All kinds of labels
| label | xlabel | headlabel | taillabel |
|---|---|---|---|
Difference between label and xlabel 1
Attribute label works not good as expected while using in subgraph.
| label | xlabel | label in subgraph | xlabel in subgraph |
|---|---|---|---|
Difference between label and xlabel 2 (constraint=false)
- The label is gone.
- Space of xlabel is not enough.
| label | |
|---|---|
| xlabel | |
| xlabel with minlen=4 |
|
| label in subgraph |
|
| xlabel in subgraph |
|
| xlabel in subgraph with minlen=4 |