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>
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];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With