How do I style the ports of record based nodes in GraphViz?

前端 未结 1 1064
轻奢々
轻奢々 2021-01-01 03:16

I\'m feeding this simple input script defining record based nodes to dot in order to create a SVG from it (the SVG part actually doesn\'t matter):

graph mygr         


        
相关标签:
1条回答
  • 2021-01-01 04:03

    HTML-like labels give you a lot of flexibility in formatting labels. This code:

    graph mygraph{
      node [shape=record, fontsize=10, fontname=Arial];
      rankdir=TB;
      ranksep=0.5;
      rank=max;
      splines=true;
      overlap=false;
      mindist=0.2;
      d1 [shape=none, margin=0, label=<
        <table border="0" cellborder="1" cellspacing="0" cellpadding="4">
            <tr><td colspan="2">d1</td></tr>
            <tr><td port="0">0</td><td>1</td></tr>
        </table>>];
      d2 [shape=none, margin=0, label=<
        <table border="0" cellborder="1" cellspacing="0" cellpadding="4">
            <tr><td colspan="4">d2</td></tr>
            <tr><td port="0">0</td><td bgcolor="green">1</td><td bgcolor="orange">2</td><td>3</td></tr>
        </table>>];
      d1:0 -- d2:0[color=blue, penwidth=3, tooltip="d1:0 -- d2:0", URL="#"];
    }
    

    Produces this graph:

    enter image description here

    Note the use of the port attribute to identify the port.

    0 讨论(0)
提交回复
热议问题