这是PlantUML中的MCVE:
@startuml
'Define the components
[Main component] as c_main_component
[comp1] as c_comp1
[com2] as c_comp2
[comp3] as c_comp3
[comp4] as c_comp4
'Define the relationships
c_main_component -- c_comp3
c_main_component -- c_comp4
c_main_component - c_comp2
c_main_component - c_comp1
@enduml
以上结果显示在下图中:
正如人们所看到的,comp3
和comp4
有一条很好的对角线,从底部将其连接到Main component
,就像预期的那样。我希望comp1
和comp2
具有相同的漂亮对角线,以从右侧连接到Main component
。我该怎么办?
由PlantUML生成的带有选项-debugsvek
的代码:
digraph unix {
nodesep=0.486111;
ranksep=0.833333;
remincross=true;
searchsize=500;
sh0004->sh0006[arrowtail=none,arrowhead=none,minlen=0,color="#000011"];
sh0004->sh0005[arrowtail=none,arrowhead=none,minlen=0,color="#000015"];
sh0004 [shape=rect,label="",width=1.722222,height=0.522352,color="#000004"];
sh0005 [shape=rect,label="",width=0.861111,height=0.522352,color="#000005"];
sh0006 [shape=rect,label="",width=0.750000,height=0.522352,color="#000006"];
sh0007 [shape=rect,label="",width=0.861111,height=0.522352,color="#000007"];
sh0008 [shape=rect,label="",width=0.861111,height=0.522352,color="#000008"];
sh0004->sh0007[arrowtail=none,arrowhead=none,minlen=1,color="#000009"];
sh0004->sh0008[arrowtail=none,arrowhead=none,minlen=1,color="#00000D"];
}
答案 0 :(得分:1)
我做了一些摆弄,尽管在这种情况下我并不直接认为它有用,但我仍然认为它可能会给您一些起点。 我找到了这篇文章:How to force node position (x and y) in graphviz
基于此,我将生成的“ debugsvek文件”(cc_svek.dot)修改为(并使一些坐标有所不同,以便更容易地通过头部进行计算,并添加了一些标签):
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => env( 'DB_HOST', '127.0.0.1' ),
'port' => env( 'DB_PORT', '3306' ),
'database' => env( 'DB_DATABASE', 'forge' ),
'username' => env( 'DB_USERNAME', 'forge' ),
'password' => env( 'DB_PASSWORD', '' ),
'unix_socket' => env( 'DB_SOCKET', '' ),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
'modes' => [
'ONLY_FULL_GROUP_BY',
'STRICT_TRANS_TABLES',
'NO_ZERO_IN_DATE',
'NO_ZERO_DATE',
'ERROR_FOR_DIVISION_BY_ZERO',
'NO_ENGINE_SUBSTITUTION',
],
],
],
在其上使用命令digraph unix {
nodesep=0.5;
ranksep=1;
remincross=true;
searchsize=500;
sh0004->sh0006[arrowtail=none,arrowhead=none,minlen=0,color="#000011"];
sh0004->sh0005[arrowtail=none,arrowhead=none,minlen=0,color="#000015"];
sh0004 [pos="1,-1!",shape=rect,label="4",width=1,height=0.5,color="#000004"];
sh0005 [pos="2,-0.75!",shape=rect,label="5",width=1,height=0.5,color="#000005"];
sh0006 [pos="2,-1.25!",shape=rect,label="6",width=1,height=0.5,color="#000006"];
sh0007 [pos="0,-2!",shape=rect,label="7",width=1,height=0.5,color="#000007"];
sh0008 [pos="1,-2!",shape=rect,label="8",width=1,height=0.5,color="#000008"];
sh0004->sh0007[arrowtail=none,arrowhead=none,minlen=1,color="#000009"];
sh0004->sh0008[arrowtail=none,arrowhead=none,minlen=1,color="#00000D"];
}
时会生成图像:
答案 1 :(得分:0)
您为什么要对c_comp1
和comp2
使用单破折号('-'),而对于c_comp3
和c_comp4
使用双破折号('-')?
用于所有双破折号时,例如:
@startuml
'Define the components
[Main component] as c_main_component
[comp1] as c_comp1
[com2] as c_comp2
[comp3] as c_comp3
[comp4] as c_comp4
'Define the relationships
c_main_component -- c_comp3
c_main_component -- c_comp4
c_main_component -- c_comp2
c_main_component -- c_comp1
@enduml
您将获得更好的图像: