Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

label hyperlink Graphviz

Tags:

graphviz

I try to find out in Graphviz, how to make a label "1" colored and at the same time a hyperlink. Is this possible? Please see the example below.

F

 <graphviz>

 digraph vvv
 {
 rankdir=LR
 a2 [href="http://www.apple.com"]
 {
 a0->a1[href="http://www.uk.com"] [label="1"] [color =red];
 a1->a2 
 }

 a2[style=filled,color=yellow]
 a0[style=filled,color=lightgrey]

 </graphviz>
like image 624
user1948258 Avatar asked Jan 04 '13 10:01

user1948258


1 Answers

Yes it's possible.

I'm assuming you are generating SVG output.

If by make a label "1" colored you mean the font color of the label text, it's as simple as specifying it in the edge attributes:

a0->a1[href="http://www.uk.com", fontcolor=yellow, color=red label="1"];

fontcolor refers to the color of the label's text, whereas color is the color of the edge itself.

If you want to have an edge label with a colored background, fillcolor is supposed to work. However, it doesn't (may depend on the version of graphviz). Therefore you may use HTML-like labels and specify the BGCOLOR:

 a0->a1[href="http://www.uk.com", fontcolor=red, label=<
     <TABLE CELLBORDER="0" CELLPADDING="0" CELLSPACING="0" BORDER="0">
         <TR><TD BGCOLOR="yellow">1KMK</TD></TR>
     </TABLE>
 >, color =red];
like image 166
marapet Avatar answered Oct 16 '22 03:10

marapet