下图显示了组织结构图:
Full Name
框沿着它们的中心对齐。但是,所需的布局会对齐顶部的框:
图表的代码如下:
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;
}
如何对齐顶部的Full Name
框?
谢谢!
答案 0 :(得分:1)
这基本上与以下问题相同:
graphviz: left/right align nodes instead of centering?
不幸的是,虽然我已经使用Graphviz大约8年了,但我不确定如何实现你想要的。
答案 1 :(得分:1)
可能不完全不是你要找的东西,但是你可以将盒子的高度设置为相同(使用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];
会导致: