【问题标题】:Unable to get subgraphs drawn无法绘制子图
【发布时间】:2017-07-11 06:01:05
【问题描述】:
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个与子图对应的容器框。但是,我得到的图像如下:

另外,我收到两个警告。

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

【问题讨论】:

    标签: graphviz dot


    【解决方案1】:

    这是您更正后的代码:

    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 语言结构,并非所有引擎都支持。

    【讨论】:

    • Cylinder 确实是 graphviz 2.38 上的一个问题,至少在我的 debian 中是这样。您可以获得修复此问题的外观 2.40 版。
    【解决方案2】:

    有两个错误:

    1. 正如另一个 post 中所解释的,子图的名称中缺少前缀“cluster”。
    2. 尾巴和头颠倒了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-27
      • 1970-01-01
      • 1970-01-01
      • 2015-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多