I am trying to display a graph with images and labels with GraphViz. I would like to display the label under the image (see labelloc="b" option on the graph) but somehow it doesn't not work. Label and image are overlapped.
Any idea what I am missing?
Below is the DOT code I am using, and the current result.
Thanks!
digraph {
graph [compound=true, labelloc="b"];
node [shape=box];
edge [dir=none];
Label1[label="Label1",image="images/Avatar1.png"];
Label2[label="Label2",image="images/Avatar2.png"];
Label3[label="Label3",image="images/Avatar3.png"];
{
rank=same;
Label1 -> h0 -> Label2;
h0[shape=circle,label="",height=0.01,width=0.01];
}
{
h0_0;
h0_0[shape=circle,label="",height=0.01,width=0.01];
}
h0 -> h0_0;
h0_0 -> Label3;
}
UPD: You need just to add an imagepos attribute to your solution with height:
digraph {
graph [compound=true, labelloc="b"];
node [shape=box];
edge [dir=none];
Label1[
label="Label1"
height="2.1"
imagepos="tc"
labelloc="b"
image="images/Avatar1.png"
];
Label2[
label="Label2"
height="2.1"
imagepos="tc"
labelloc="b"
image="images/Avatar2.png"
];
Label3[
label="Label3"
height="2.1"
imagepos="tc"
labelloc="b"
image="images/Avatar3.png"
];
{
rank=same;
Label1 -> h0 -> Label2;
h0[shape=circle,label="",height=0.01,width=0.01];
}
{
h0_0;
h0_0[shape=circle,label="",height=0.01,width=0.01];
}
h0 -> h0_0;
h0_0 -> Label3;
}
Result:
Or you may also use HTML-like labels, and specifically, tables:
digraph {
graph [compound=true, labelloc="b"];
node [shape=box];
edge [dir=none];
Label1 [
shape=plain
label=<
<table cellspacing="0" border="0" cellborder="1">
<tr><td><img src="images/Avatar1.png" /></td></tr>
<tr><td>Label1</td></tr>
</table>
>
];
Label2 [
shape=plain
label=<
<table cellspacing="0" border="0" cellborder="1">
<tr><td><img src="images/Avatar2.png" /></td></tr>
<tr><td>Label2</td></tr>
</table>
>
];
Label3 [
shape=plain
label=<
<table cellspacing="0" border="0" cellborder="1">
<tr><td><img src="images/Avatar3.png" /></td></tr>
<tr><td>Label3</td></tr>
</table>
>
];
{
rank=same;
Label1 -> h0 -> Label2;
h0[shape=circle,label="",height=0.01,width=0.01];
}
{
h0_0;
h0_0[shape=circle,label="",height=0.01,width=0.01];
}
h0 -> h0_0;
h0_0 -> Label3;
}
The code is a bit more complex (at first glance), but as a bonus you get more flexible control over the borders.
Result:
By specifying a "height" (warning, those are "inches") for the nodes, I get the "labelloc" to work and I can thus move the label out of the picture. I would prefer if the box didn't have that white place at the top, but it's better than before.
Related
In order to model some sort of (nested/layered) system architecture I am trying to figure out how to draw a box that has multiple "entry points" (aka interfaces). The goal is which component uses which interface to communicate with another component.
Here is a hand drawn example to illustrate the goal:
Note that the yellow boxes are systems made of components (blue boxes). The green dots are interfaces of components. If an interface is exposed to components from outside the system, the interface needs to be propagated on system level (red dots).
For the interfaces of components (green dots) a "record-based node" does the trick; a "table cell" in the top row can be used to act as an interface.
What I have not figured out yet is the "system interface" part (red dots). Is there a way how I place for example a "circle" shape explicitly on the border of a subgraph? Or do you have an other solution in mind how I can emulate the representation of a "system interface"?
You can get fairly close by using non-standard "arrowheads" (https://graphviz.org/doc/info/arrows.html), but tough/impossible to get
circles on the border
edges to "line up" (can't declare an edge from an interior node to its own cluster)
see graph below
It is possible to draw the desired graph with Graphviz by explicitly positioning nodes, including the colored points, setting X,Y coordinates (see https://www.graphviz.org/faq/#FaqDotWithNodeCoords). Instead, I'd suggest using one of the PIC language implementation. Specifically, pikchr (https://pikchr.org/home/doc/trunk/homepage.md)
Best dot version (without explicit positioning):
Using additional hidden edges and nodes you can get a partial solution, but surely there are better tools, as already said, in graphviz you can not easy place a point on the boundary of a cluster and keep the code clean of extra nodes (unless it's not neato engine).
Variant with hidden elements, image:
and script:
digraph system_architecture {
graph [
newrank=true
ranksep=0
compound=true
splines=curved]
subgraph cluster_S1 {
style=filled
fillcolor="lightyellow"
label="Sys 1"
labelloc="b"
margin=3
sys1_rest_dot_1 [shape=point height=0]
sys1_rest_dot_2 [shape=point height=0]
comp11_rest_dot [shape=point height=0]
comp12_graphql_dot [shape=point height=0]
subgraph cluster_C11 {
label=""
style="filled"
fillcolor="cyan"
comp11 [label="Comp 1.1" shape=none]
}
subgraph cluster_C12 {
label=""
style="filled"
fillcolor="cyan"
comp12 [label="Comp 1.2" shape=none]
}
}
invis_node [style=invis]
invis_node -> sys1_rest_dot_1 [lhead="cluster_S1" color=none minlen=2]
sys1_rest_dot_1 -> sys1_rest_dot_2 [lhead="cluster_S1" arrowsize=1 penwidth=10 arrowhead=dot color=red headlabel="REST"]
sys1_rest_dot_2 -> comp11_rest_dot [minlen=4 headlabel="REST" arrowhead=vee ]
comp11_rest_dot -> comp11 [lhead="cluster_C11" arrowsize=1 penwidth=10 arrowhead=dot color=lime]
comp11 -> comp12_graphql_dot [minlen=3 lhead="cluster_C12" headlabel="GraphQL" arrowhead=vee]
comp12_graphql_dot -> comp12 [lhead="cluster_C12" arrowsize=1 penwidth=10 arrowhead=dot color=lime]
subgraph cluster_S2 {
style=filled
fillcolor="lightyellow"
label="Sys 2"
labelloc="b"
margin=3
sys2_rest_dot_1 [shape=point height=0]
sys2_rest_dot_2 [shape=point height=0]
comp21_rest_dot [shape=point height=0]
comp22_sql_dot [shape=point height=0]
sys2_soa_dot_1 [shape=point height=0]
sys2_soa_dot_2 [shape=point height=0]
comp22_soa_dot [shape=point height=0]
subgraph cluster_C21 {
label=""
style="filled"
fillcolor="cyan"
comp21 [label="Comp 2.1" shape=none]
}
subgraph cluster_C22 {
label=""
style="filled"
fillcolor="cyan"
comp22 [label="Comp 2.2" shape=none]
}
}
comp12 -> sys2_rest_dot_1 [arrowhead=vee]
sys2_rest_dot_1 -> sys2_rest_dot_2 [lhead="cluster_S2" arrowsize=1 penwidth=10 arrowhead=dot color=red headlabel="REST"]
sys2_rest_dot_2 -> comp21_rest_dot [minlen=4 headlabel="REST" arrowhead=vee ]
comp21_rest_dot -> comp21 [lhead="cluster_C21" arrowsize=1 penwidth=10 arrowhead=dot color=lime]
comp21 -> comp22_sql_dot [minlen=3 lhead="cluster_C22" headlabel="SQL" arrowhead=vee]
comp22_sql_dot -> comp22 [lhead="cluster_C22" arrowsize=1 penwidth=10 arrowhead=dot color=lime]
comp12 -> sys2_soa_dot_1 [arrowhead=vee]
sys2_soa_dot_1 -> sys2_soa_dot_2 [lhead="cluster_S2" arrowsize=1 penwidth=10 arrowhead=dot color=red headlabel="SOA"]
sys2_soa_dot_2 -> comp22_soa_dot [minlen=7 headlabel="SOA" arrowhead=vee]
comp22_soa_dot -> comp22 [ head="cluster_C21" arrowsize=1 penwidth=10 arrowhead=dot color=lime]
}
Variant without tricks (does not fit the question, but code is clean), image:
and script:
digraph system_architecture {
graph [
overlap=false
ranksep=.6
nodesep=.6
compound=true
splines=curved
fontname="Arial"]
subgraph cluster_S1 {
style=filled
fillcolor="lightyellow"
label="Sys 1"
rest_s1 [shape=circle label="" height=.2 fillcolor=red style=filled xlabel=<<FONT FACE="Arial">REST</FONT>>]
subgraph cluster_C11 {
label=""
style="filled"
fillcolor="cyan"
rest_c11 [shape=circle label="" height=.2 fillcolor=lime style=filled xlabel=<<FONT FACE="Arial">REST</FONT>>]
comp11 [label=<<FONT FACE="Arial">Comp 1.1</FONT>> shape=none]
}
subgraph cluster_C12 {
label="";
style="filled"
fillcolor="cyan"
graphql_c12 [shape=circle label="" height=.2 fillcolor=lime style=filled xlabel=<<FONT FACE="Arial">GraphQL</FONT>>]
comp12 [label=<<FONT FACE="Arial">Comp 1.2</FONT>> shape=none]
}
}
rest_s1 -> rest_c11 [arrowhead=vee]
comp11 -> graphql_c12 [ltail="cluster_C11" arrowhead=vee]
subgraph cluster_S2 {
style=filled
fillcolor="lightyellow"
label="Sys 2"
rest_s2 [shape=circle label="" height=.2 fillcolor=red style=filled xlabel=<<FONT FACE="Arial">REST</FONT>>]
soa_s2 [shape=circle label="" height=.2 fillcolor=red style=filled xlabel=<<FONT FACE="Arial">SOA</FONT>>]
subgraph cluster_C21 {
label=""
style="filled"
fillcolor="cyan"
rest_c21 [shape=circle label="" height=.2 fillcolor=lime style=filled xlabel=<<FONT FACE="Arial">REST</FONT>>]
comp21 [label=<<FONT FACE="Arial">Comp 2.1</FONT>> shape=none]
}
subgraph cluster_C22 {
label="";
style="filled"
fillcolor="cyan"
sql_c22 [shape=circle label="" height=.2 fillcolor=lime style=filled xlabel=<<FONT FACE="Arial">SQL</FONT>>]
soa_c22 [shape=circle label="" height=.2 fillcolor=lime style=filled xlabel=<<FONT FACE="Arial">SOA</FONT>>]
comp22 [label="Comp 2.2" shape=none labelfontname="Arial"]
}
}
comp12 -> rest_s2 [ltail="cluster_C12" arrowhead=vee]
comp12 -> soa_s2 [ltail="cluster_C12" arrowhead=vee]
rest_s2 -> rest_c21 [arrowhead=vee]
soa_s2 -> soa_c22 [arrowhead=vee]
comp21 -> sql_c22 [ltail="cluster_C21" arrowhead=vee]
}
I'm trying to make a State diagram of the Vendor Machine with the help of Graphviz.
I want a outcome close to this one.
It consists of nested State Machines as well. Here is what I have done so far in Graphviz. Please find the online demo here.
digraph vendorMachine {
compound=true
Entry[shape="point" label=""]
subgraph cluster_cancel {
label = "Cancel"
style = rounded
C0 [label = <
<table cellborder="0" style="rounded">
<tr><td>C0</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C25 [label = <
<table cellborder="0" style="rounded">
<tr><td>C25</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C50 [label = <
<table cellborder="0" style="rounded">
<tr><td>C50</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C75 [label = <
<table cellborder="0" style="rounded">
<tr><td>C75</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
subgraph cluster_DispenseC100Drink {
label = "DispenseC100Drink"
style = rounded
C100 [label = <
<table cellborder="0" style="rounded">
<tr><td>C100</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
subgraph cluster_DispenseC125Drink {
label = "DispenseC125Drink"
style = rounded
C125 [label = <
<table cellborder="0" style="rounded">
<tr><td>C125</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C150 [label = <
<table cellborder="0" style="rounded">
<tr><td>C150</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C175 [label = <
<table cellborder="0" style="rounded">
<tr><td>C175</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C200 [label = <
<table cellborder="0" style="rounded">
<tr><td>C200</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
}
}
}
Entry -> C0
C0 -> C25[label=" Add\n$0.25 "]
C0 -> C50[label=" Add\n$0.50 "]
C25 -> C50[label=" Add\n$0.25 "]
C25 -> C75[label=" Add\n$0.50 "]
C50 -> C75[label=" Add\n$0.25 "]
C50 -> C100[label=" Add\n$0.50 "]
C100 -> C0[label=" Dispense\n $1.00 Drink " ltail="cluster_DispenseC100Drink"]
C75 -> C100[label=" Add\n$0.25 "]
C75 -> C125[label=" Add\n$0.50 "]
C100 -> C125[label=" Add\n$0.25 "]
C100 -> C150[label=" Add\n$0.50 "]
C125 -> C150[label=" Add\n$0.25 "]
C125 -> C175[label=" Add\n$0.50 "]
C125 -> C0[label=" Dispense\n $1.25 Drink " ltail="cluster_DispenseC125Drink"]
C150 -> C175[label=" Add\n$0.25 "]
C150 -> C200[label=" Add\n$0.50 "]
C175 -> C200[label=" Add\n$0.25 "]
C200 -> C0[label=" Dispense\n $2.00 Drink "]
}
So, my queries are:
How to make this similar to the mentioned image?
Is there any other better way to do this apart from my Graphviz code? (Is this the best approach what I have done so far)
One transition is missing in Graphviz code that If we pass Cancel event, it should go to state C0 (Please check in attached image). How can we implement this with Graphviz?
Thanks in advance for the suggestions and answers.
"Straight" Graphviz (command line) produces a different (and "closer") result. Here is you program with just a few tweaks:
digraph vendorMachine {
compound=true
graph [color=red]
node [color=red] // yuck style=filled fillcolor=yellow]
edge [color=red]
Entry[shape="point" label=""]
subgraph cluster_cancel {
label = "Cancel"
style = rounded
E2 [shape=rect label="" width=2 style=invis]
E2:sw->C0 [label=cancel]
C0 [label = <
<table cellborder="0" style="rounded">
<tr><td>C0</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C25 [label = <
<table cellborder="0" style="rounded">
<tr><td>C25</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C50 [label = <
<table cellborder="0" style="rounded">
<tr><td>C50</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C75 [label = <
<table cellborder="0" style="rounded">
<tr><td>C75</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
subgraph cluster_DispenseC100Drink {
label = "DispenseC100Drink"
style = rounded
C100 [label = <
<table cellborder="0" style="rounded">
<tr><td>C100</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
subgraph cluster_DispenseC125Drink {
label = "DispenseC125Drink"
style = rounded
C125 [label = <
<table cellborder="0" style="rounded">
<tr><td>C125</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C150 [label = <
<table cellborder="0" style="rounded">
<tr><td>C150</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C175 [label = <
<table cellborder="0" style="rounded">
<tr><td>C175</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
C200 [label = <
<table cellborder="0" style="rounded">
<tr><td>C200</td></tr>
<hr/>
<tr><td></td></tr>
</table>
> margin=0 shape=none]
}
}
}
Entry -> C0
C0 -> C25[label=" Add\n$0.25 "]
C0 -> C50[label=" Add\n$0.50 "]
C25 -> C50[label=" Add\n$0.25 "]
C25 -> C75[label=" Add\n$0.50 "]
C50 -> C75[label=" Add\n$0.25 "]
C50 -> C100[label=" Add\n$0.50 "]
C100 -> C0[label=" Dispense\n $1.00 Drink " ltail="cluster_DispenseC100Drink"]
C75 -> C100[label=" Add\n$0.25 "]
C75 -> C125[label=" Add\n$0.50 "]
C100 -> C125[label=" Add\n$0.25 "]
C100 -> C150[label=" Add\n$0.50 "]
C125 -> C150[label=" Add\n$0.25 "]
C125 -> C175[label=" Add\n$0.50 "]
C125 -> C0[label=" Dispense\n $1.25 Drink " ltail="cluster_DispenseC125Drink"]
C150 -> C175[label=" Add\n$0.25 "]
C150 -> C200[label=" Add\n$0.50 "]
C175 -> C200[label=" Add\n$0.25 "]
C200 -> C0[label=" Dispense\n $2.00 Drink "]
}
Giving:
Is this close enough? (done by eyeball)
subgraph cluster_cancel {
label = <
<table cellborder="0" border="0">
<tr><td width="478" >Cancel</td></tr>
<hr/>
<tr><td></td></tr>
</table>
>
Consider the graph
digraph "Graph b9ca21a1-971e-400c-a7f4-cd650986476a" {
graph [ margin=10 ];
node [ shape=point ];
"Invisible" [
//height=0,
//width=0,
//margin=0,
//style=invis,
color="red"
];
subgraph "cluster_1" {
"A";
"B";
"Invisible";
"C";
"D";
}
}
resulting in
I want the red node to be completely invisible, taking up no space, but it has to remain there, such that it can be used for lhead/ltail an other such miscellaneous things.
When uncommenting the commented lines, the result is
As you see, there is still a spatial artifact of this node.
Question: is there a way to remove this completely, without affecting the other nodes' layout in the graph?
You can use nodesep to minimize the node separation (min is 0.02) and instead add invisible peripheries to the visible nodes in order accomplish an approximately equal separation of them.
Here's an example of how to transform an approximation of your first graph into an approximation of the second:
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="//d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/viz.js#1.8.0/viz.js"></script>
<script src="https://unpkg.com/d3-graphviz#0.1.2/build/d3-graphviz.min.js"></script>
<div id="graph" style="text-align: center;"></div>
<script>
var dots = [
`
digraph "Graph b9ca21a1-971e-400c-a7f4-cd650986476a" {
graph [ margin=10, nodesep=0 ];
node [ shape=point, peripheries=3, penwidth=0 ];
"Invisible" [
//height=0,
//width=0,
//margin=0,
//style=invis,
color="red"
];
subgraph "cluster_1" {
"A";
"B";
"Invisible";
"C";
"D";
}
"X" [color="blue"];
"X" -> "Invisible" [headclip="false"]
}
`, `
digraph "Graph b9ca21a1-971e-400c-a7f4-cd650986476a" {
graph [ margin=10, nodesep=0 ];
node [ shape=point, peripheries=3, penwidth=0 ];
"Invisible" [
peripheries=0,
height=0,
width=0,
// margin=0,
// style=invis,
color="red"
];
subgraph "cluster_1" {
"A";
"B";
"Invisible";
"C";
"D";
}
"X" [color="blue"];
"X" -> "Invisible" [headclip="false"]
}
`
];
var dotIndex = 0;
var graphviz = d3.select("#graph").graphviz();
function render() {
var dot = dots[dotIndex % dots.length];
var transition1 = d3.transition()
.delay(1000)
.duration(1000 + 4000 * dotIndex);
graphviz
.tweenShapes(false)
.engine("dot")
.dot(dot)
.transition(transition1)
.render();
dotIndex += 1;
transition1
.transition()
.duration(0)
.on('end', function () {
if (dotIndex != dots.length) {
render();
}
});
}
render();
</script>
I am using Graphviz to create a graph with nodes that are HTML-like labels. My dot file:
digraph 0 {
center = true
charset = "UTF-8"
overlap = false
splines = true
landscape = false
id = "0"
label = "Graph Example"
labelloc = "t"
node [shape = none width = 0 height = 0 margin = 0 fontcolor = blue ]
0 [ label = <
<TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
<TR>
<TD PORT = "0" >Node 0</TD>
</TR>
<TR>
<TD CELLSPACING = "0" CELLPADDING = "0" >
<TABLE BORDER = "0" CELLSPACING = "1" CELLBORDER = "0" CELLPADDING = "0" >
<TR>
<TD PORT = "4"> </TD>
<TD PORT = "1"> </TD>
<TD PORT = "2"> </TD>
<TD PORT = "3"> </TD>
<TD PORT = "6"> </TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE> > ]
4 [ label = <
<TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
<TR>
<TD PORT = "4" >Node 1</TD>
</TR>
<TR>
<TD CELLSPACING = "0" CELLPADDING = "0" >
<TABLE BORDER = "0" CELLSPACING = "1" CELLBORDER = "0" CELLPADDING = "0" >
<TR>
<TD PORT = "6"> </TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE> > ]
6 [ label = <
<TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
<TR>
<TD PORT = "6" >Node 6</TD>
</TR>
</TABLE> > ]
1 [ label = <
<TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
<TR>
<TD PORT = "1">Node 1</TD>
</TR>
<TR>
<TD CELLSPACING = "0" CELLPADDING = "0" >
<TABLE BORDER = "0" CELLSPACING = "1" CELLBORDER = "0" CELLPADDING = "0" >
<TR>
<TD PORT = "4"> </TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE> > ]
2 [ label = <
<TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
<TR>
<TD PORT = "2">Node 2</TD>
</TR>
<TR>
<TD CELLSPACING = "0" CELLPADDING = "0" >
<TABLE BORDER = "0" CELLSPACING = "1" CELLBORDER = "0" CELLPADDING = "0" >
<TR>
<TD PORT = "4"> </TD>
<TD PORT = "5"> </TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE> > ]
5 [ label = <
<TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
<TR>
<TD PORT = "5" >Node 5</TD>
</TR>
</TABLE> > ]
3 [ label = <
<TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
<TR>
<TD PORT = "3" >Node 3</TD>
</TR>
<TR>
<TD CELLSPACING = "0" CELLPADDING = "0" >
<TABLE BORDER = "0" CELLSPACING = "1" CELLBORDER = "0" CELLPADDING = "0" >
<TR>
<TD PORT = "5"> </TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE> > ]
1:4:s -> 4:4:n
2:4:s -> 4:4:n
2:5:s -> 5:5:n
0:1:s -> 1:1:n
0:2:s -> 2:2:n
0:3:s -> 3:3:n
0:6:s -> 6:6:n
4:6:s -> 6:6:n
3:5:s -> 5:5:n
0:4:s -> 4:4:n
edge [color = red constraint = false ]
1:1 -> 4:4
1:1 -> 3:3
}
And I am using ports to define where on the node I want to connect with other nodes. Attached the image generated by dot.
I would like to have the edges drawn as polylines instead of curved arcs. I tried to modify the splines attribute for the graph but it does not work, in fact from the graphviz documentation I found this: "The value ortho specifies edges should be routed as polylines of axis-aligned segments. Currently, the routing does not handle ports or, in dot, edge labels."
Can you help in finding a solution to have polylines (or better looking edges) using ports?
Thanks.
simply change:
splines = true
to
splines = polyline
did the trick for me
result
my problem is I have a ngRepeat inside another and I need a count starting at 0 that follow 1, 2, 3, 4, etc ...
But I can not, I need help with this because I can not think of anything, here is the link in plunker.
Thank you.
What exactly do you need the index for? Why not just implement that functionality in your controller and attach it to the object? 1 more tip - use ng-class to dynamically set the style of your table row.
Spain someone helped me , I leave the solution:
angular.module('app', [])
.controller('groupColorsController', function groupColors($scope){
$scope.colors = [
{name : "rojos", color : [
["IndianRed", "CD5C5C"],
["LightCoral", "F08080"],
["Salmon", "FA8072"]
]},
{name : "rosados", color : [
["Pink", "FFC0CB"],
["LightPink", "FFB6C1"],
["HotPink", "FF69B4"]
]},
{name : "narajnas", color : [
["Coral", "FF7F50"],
["Tomato", "FF6347"],
["OrangeRed", "FF4500"]
]}
];
})
.controller('colorController', function($scope) {
// $scope -> scope de colorController
// $scope.$parent -> scope de ng-repeat interior
// $scope.$parent.$parent -> scope de ng-repeat exterior
// $scope.$parent.$parent.$parent -> scope de groupColorsController
$scope.id = 0
for(var i = 0; i < $scope.$parent.$parent.$index; ++i) {
console.log($scope.$parent.$parent.$parent.colors[i].color.length)
$scope.id += $scope.$parent.$parent.$parent.colors[i].color.length
}
console.log($scope.$index)
$scope.id += $scope.$index + 1;
});
<body ng-app="app">
<div class="container">
<div class="table-responsive" ng-controller="groupColorsController">
<table class="table table-condensed table-bordered">
<tbody ng-repeat="colors in colors">
<tr>
<th colspan="3"><h3><strong>Colores {{colors.name}}</strong></h3></th>
</tr>
<tr>
<th>Nombre</th>
<th>Código hexadecimal</th>
<th>ID</th>
</tr>
<tr ng-repeat="color in colors.color" ng-controller="colorController" style="background-color:{{color[0]}}">
<td>{{color[0]}}</td>
<td>{{color[1]}}</td>
<td>{{id}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
but I could not do AngularJS D: