linrongbin
linrongbin

Reputation: 3361

graphviz dot HTML attributes not working?

I'm drawing a graph on macbook with graphviz dot, here's my graph simple.dot:

digraph {
    node [shape=record, fontname="Courier New, Courier", fontsize=12]
    graph [fontname="Courier New, Courier", fontsize=12]
    edge [fontname="Courier New, Courier", fontsize=12]

    node626 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
        <TR><TD PORT="cell625">global.1</TD></TR>
        <TR><TD PORT="cell627">symbol: name: integer_literal, type: ()=&gt;void, kind: Func</TD></TR>
        <TR><TD PORT="cell633">symbol: name: string_literal, type: ()=&gt;void, kind: Func</TD></TR>
        <TR><TD PORT="cell639">symbol: name: floating_point_literal, type: ()=&gt;void, kind: Func</TD></TR>
        <TR><TD PORT="cell645">symbol: name: character_literal, type: ()=&gt;void, kind: Func</TD></TR>
        <TR><TD PORT="cell651">typeSymbol: name: byte, kind: Plain</TD></TR>
        <TR><TD PORT="cell652">typeSymbol: name: ubyte, kind: Plain</TD></TR>
        <TR><TD PORT="cell653">typeSymbol: name: short, kind: Plain</TD></TR>
        <TR><TD PORT="cell654">typeSymbol: name: ushort, kind: Plain</TD></TR>
        <TR><TD PORT="cell655">typeSymbol: name: int, kind: Plain</TD></TR>
        <TR><TD PORT="cell656">typeSymbol: name: uint, kind: Plain</TD></TR>
        <TR><TD PORT="cell657">typeSymbol: name: long, kind: Plain</TD></TR>
        <TR><TD PORT="cell658">typeSymbol: name: ulong, kind: Plain</TD></TR>
        <TR><TD PORT="cell659">typeSymbol: name: float, kind: Plain</TD></TR>
        <TR><TD PORT="cell660">typeSymbol: name: double, kind: Plain</TD></TR>
        <TR><TD PORT="cell661">typeSymbol: name: char, kind: Plain</TD></TR>
        <TR><TD PORT="cell662">typeSymbol: name: boolean, kind: Plain</TD></TR>
        <TR><TD PORT="cell663">typeSymbol: name: void, kind: Plain</TD></TR></TABLE>>]
    node629 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
        <TR><TD PORT="cell628">integer_literal</TD></TR>
        <TR><TD PORT="cell630">symbol: name: local.2, type: void, kind: Local</TD></TR></TABLE>>]
    node632 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
        <TR><TD PORT="cell631">local.2</TD></TR></TABLE>>]
    node635 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
        <TR><TD PORT="cell634">string_literal</TD></TR>
        <TR><TD PORT="cell636">symbol: name: local.3, type: void, kind: Local</TD></TR></TABLE>>]
    node638 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
        <TR><TD PORT="cell637">local.3</TD></TR></TABLE>>]
    node641 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
        <TR><TD PORT="cell640">floating_point_literal</TD></TR>
        <TR><TD PORT="cell642">symbol: name: local.4, type: void, kind: Local</TD></TR></TABLE>>]
    node644 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
        <TR><TD PORT="cell643">local.4</TD></TR></TABLE>>]
    node647 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
        <TR><TD PORT="cell646">character_literal</TD></TR>
        <TR><TD PORT="cell648">symbol: name: local.5, type: void, kind: Local</TD></TR></TABLE>>]
    node650 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
        <TR><TD PORT="cell649">local.5</TD></TR></TABLE>>]

    node629:cell630 -> node632:cell631
    node626:cell627 -> node629:cell628
    node635:cell636 -> node638:cell637
    node626:cell633 -> node635:cell634
    node641:cell642 -> node644:cell643
    node626:cell639 -> node641:cell640
    node647:cell648 -> node650:cell649
    node626:cell645 -> node647:cell646
}

Compiled with dot -Tpng simple.dot -o simple.png, it gives me:

simple.png

But the PORT seems not working, because the edges should point from <TD> to another <TD>. And <TABLE BORDER> also not working because my table border is bold.

Please help.

Upvotes: 1

Views: 547

Answers (1)

sroush
sroush

Reputation: 6763

The core problem in your file is this line:

node [shape=record, fontname="Courier New, Courier", fontsize=12]

What you want is node [shape=none ...]

node [shape=none, fontname="Courier New, Courier", fontsize=12]

This fixes the table border and the port problems. If you add a compass point to some of the edges, things get even better.

 node626:cell627 -> node629:cell628:n

enter image description here

Upvotes: 2

Related Questions