【问题标题】:graphviz/DOT subgraph/cluster ERROR label&color attribute not allowedgraphviz/DOT 子图/集群错误标签和颜色属性不允许
【发布时间】:2020-10-16 08:05:25
【问题描述】:

我正在尝试使用 Java (guru.nidi.graphviz.parse.Parser) 构建一个带有集群节点的 GraphViz 图形,但每次尝试构建时都会收到错误消息。

20:26:25.983 [main] INFO guru.nidi.graphviz.parse.Parser - ERROR label at 51:3 Attribute is not allowed for scope 'SUB_GRAPH'.

20:26:25.987 [main] INFO guru.nidi.graphviz.parse.Parser - ERROR color at 53:1 Attribute is not allowed for scope 'SUB_GRAPH'.

我的代码一开始就存在

digraph g { 
graph [bgcolor=grey15, fontcolor=grey70]; 
node [color=grey70,style=filled, fontcolor=grey15, fontsize=18]; 
edge [color=grey70,fontcolor=grey70, fontsize=18fontsize=18]; 

然后是一些节点和边定义,例如

"lorem" [label="lorem"]; 
"foo bar" -> "lorem"; 
"ipsum" [shape=diamond]; 
...

最后是一些子图簇的定义:

subgraph Foos{
  label="Foos";
  {rank=same "lorem"; "foo bar"; }
color=blue; 
}
...

集群工作(集群的节点彼此相邻。当我在子图括号之间添加边缘连接时,它们会显示子图节点。)

我将自己定位在GraphVIZ-dotguide(第23页)和these Graphviz-dot-examples(“子图(集群)”部分)。那么也许有人可以帮助我解决这个问题?

非常感谢!

【问题讨论】:

  • 您是否可能遗漏了一些代码?这些错误似乎与数据格式有关,因此文件的前几行可能存在错误(如果有)。另外,它抱怨的台词是什么? (51 和 53)

标签: java graphviz dot


【解决方案1】:

没关系,我没想到会这么容易。如果我以cluster 开始我的子图名,比如clusterFoos 而不是Foos,那么它应该是这样工作的。

【讨论】:

    猜你喜欢
    • 2020-09-09
    • 1970-01-01
    • 2021-01-05
    • 2012-09-23
    • 2016-06-20
    • 1970-01-01
    • 2018-10-25
    • 2012-09-05
    • 1970-01-01
    相关资源
    最近更新 更多