无法绘制子图

时间:2017-07-10 21:15:40

标签: graphviz dot

digraph G {
    compound=true;

    subgraph SJC {
        node [style="filled"];  
        label = "SJC";
        channel [shape=cylinder];

    }
    subgraph Fleet {
        node [style="filled"];
        App1 [shape=cylinder];
        App2 [shape=cylinder];
        App3 [shape=cylinder];
        label = "Fleet of machines";
        style="filled";
        color="lightgrey";

    }

    App1 -> channel [ltail=SJC, lhead=Fleet];

}

使用上面的代码,我的期望是获得对应于子图的2个容器盒。但是,我得到的图像如下:

enter image description here

另外,我收到两个警告。

Warning: cluster named Fleet not found
Warning: cluster named SJC not found

2 个答案:

答案 0 :(得分:2)

有两个错误:

  1. 正如另一个post中所述,前缀" 群集"在子图的名称中缺失。
  2. 尾巴和头部相反。

答案 1 :(得分:2)

以下是您更正后的代码:

digraph G {
compound=true;

subgraph cluster_SJC {
    node [style="filled"];  
    label = "SJC";
    channel [shape=cylinder];
}

subgraph cluster_Fleet {
    node [style="filled"];
    App1 [shape=cylinder];
    App2 [shape=cylinder];
    App3 [shape=cylinder];
    label = "Fleet of machines";
    style="filled";
    color="lightgrey";
}

App1 -> channel [lhead=cluster_SJC, ltail=cluster_Fleet];

}

我的“气缸”呈现为方框。从来没有让圆柱形状在graphviz 2.38.0中工作。

子图名称之前的cluster_约定是所有引擎都不支持的dot语言构造。 enter image description here