How do I associate SVG elements generated by graphviz to elements in the DOT source code

后端 未结 2 1536
野的像风
野的像风 2021-02-09 17:00

So, I\'ve generated an svg graph from the dot file, using viz.js.
Now, it\'s easy to select it\'s elements, using javascript, but I don\'t see any association to the origi

2条回答
  •  轮回少年
    2021-02-09 18:04

    There's an undocumented feature where graphviz accepts class attributes and outputs them as svg class="foo". Example:

    $ cat test.dot
    digraph G {
      graph [class="cats"];
    
      subgraph cluster_big {
        graph [class="big_cats"];
    
        "Lion" [class="yellow social"];
        "Snow Leopard" [class="white solitary"];
      };
    }
    
    $ dot -Tsvg ~/test.dot | grep "
    
    

提交回复
热议问题