gpt4 book ai didi

graphviz - 顶部对齐节点

转载 作者:行者123 更新时间:2023-12-03 06:40:12 25 4
gpt4 key购买 nike

问题

下图显示了组织结构图:

Not desired output

全名框沿中心对齐。然而,所需的布局是将框沿顶部对齐:

Desired output

源代码

该图的代码如下:

digraph G {
fixedwidth = true;

node [
shape="box",
style="rounded",
penwidth = 1,
width=2.0,
fontname = "Arial",
fontsize = 12
];

edge [
color="#142b30",
arrowhead="vee",
arrowsize=0.75,
penwidth = 2,
weight=1.0
];

A1 [ label = <
<TABLE BORDER="0" CELLSPACING="5">
<TR>
<TD><FONT POINT-SIZE="16">Top Level</FONT></TD>
</TR>
<TR>
<TD><FONT POINT-SIZE="18">Owner</FONT></TD>
</TR>
</TABLE>>
];

B3 [ label = <
<TABLE BORDER="0" CELLSPACING="5">
<TR>
<TD><FONT POINT-SIZE="12">Second Level<BR/>(1)</FONT></TD>
</TR>
<TR>
<TD><FONT POINT-SIZE="14">Owner</FONT></TD>
</TR>
</TABLE>>
];

B4 [ label = <
<TABLE BORDER="0" CELLSPACING="5">
<TR>
<TD><FONT POINT-SIZE="12">Second Level<BR/>(2)</FONT></TD>
</TR>
<TR>
<TD><FONT POINT-SIZE="14">Owner</FONT></TD>
</TR>
</TABLE>>
];

B5 [ label = <
<TABLE BORDER="0" CELLSPACING="5">
<TR>
<TD><FONT POINT-SIZE="12">Second Level<BR/>(3)</FONT></TD>
</TR>
<TR>
<TD><FONT POINT-SIZE="14">Owner</FONT></TD>
</TR>
</TABLE>>
];

B6 [ label = <
<TABLE BORDER="0" CELLSPACING="5">
<TR>
<TD><FONT POINT-SIZE="12">Second Level<BR/>(4)</FONT></TD>
</TR>
<TR>
<TD><FONT POINT-SIZE="14">Owner</FONT></TD>
</TR>
</TABLE>>
];

C4 [ label = <
<TABLE BORDER="0" CELLPADDING="0" ALIGN="LEFT">
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
</TABLE>>
];

C5 [ label = <
<TABLE BORDER="0" CELLPADDING="0" ALIGN="LEFT">
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
</TABLE>>
];

C6 [ label = <
<TABLE BORDER="0" CELLPADDING="0" ALIGN="LEFT">
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
</TABLE>>
];

C7 [ label = <
<TABLE BORDER="0" CELLPADDING="0" ALIGN="LEFT">
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><FONT POINT-SIZE="10">Full Name</FONT></TD>
</TR>
</TABLE>>
];

{ rank = same; B3; B4; B5; B6; }

A1 -> B3:n;
A1 -> B4:n;
A1 -> B5:n;
A1 -> B6:n;

{ rank = same; C4; C5; C6; C7; }

B3 -> C4;
B4 -> C5;
B5 -> C6;
B6 -> C7;
}

问题

如何将全名框沿顶部对齐?

谢谢!

最佳答案

可能不完全是您正在寻找的内容,但您可以将框的高度设置为相同(通过使用 fixedsize=true,height="some number" 然后您可以使用文本居中于中间(默认情况下)。因此添加以下行:

C4 [fixedsize=true,height=2];
C5 [fixedsize=true,height=2];
C6 [fixedsize=true,height=2];
C7 [fixedsize=true,height=2];

会导致: looks better if not fully there...

关于graphviz - 顶部对齐节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8935039/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com