此Graphviz代码:
digraph models_diagram {
graph[rankdir=LR, overlap=false, splines=true]
struct1 [shape=record, label="Table 0|<f0> ID: integer|<f1> TABLE_1_ID: integer"]
struct2 [shape=record, label="Table 1|<f0> ID: integer|<f1> NAME: string"]
struct2:f0 -> struct1:f1;
}
将创建此ERD:
我想将特殊格式(例如背景颜色;字体粗细)应用于每个矩形的标题(例如&#34;表1和#34;)。
我考虑过将一个形状嵌入到另一个形状中,然后我可以在其中一个形状上设置style=filled, color=lightgrey
,但我无法使用该语法。
这可能吗?
答案 0 :(得分:4)
此:
digraph models_diagram{
graph[rankdir=LR, overlap=false, splines=true];
node [shape=record, fontsize=9, fontname="Verdana"];
edge [style=dashed];
table0 [shape=none, margin=0, label=<
<table border="0" cellborder="1" cellspacing="0" cellpadding="4">
<tr><td bgcolor="lightblue">Table 0</td></tr>
<tr><td port="0" align="left">ID: integer</td></tr>
<tr><td port="2" align="left">TABLE_1_ID: integer</td></tr>
</table>>];
table1 [shape=none, margin=0, label=<
<table border="0" cellborder="1" cellspacing="0" cellpadding="4">
<tr><td bgcolor="lightblue">Table 1</td></tr>
<tr><td port="0" align="left">ID: integer</td></tr>
<tr><td port="1" align="left">NAME: string</td></tr>
</table>>];
table1:0 -> table0:2;
}
导致这一点: