aligning compound boxes

0 votes
asked Apr 22, 2016 in Wanted features by yann (200 points)
edited Apr 22, 2016 by yann
In the following graph, without the enclosing folders and frames the graph is quite nicely laid out, and I did not expect that adding those groups would cause the whole.  It may not be easy or possible to lower their impact on the layout, but a workaround could be to provide more control on the layout.

Eg, is it possible to force alignment of compound/group boxes in some way (like dot's rankdir / rank), or givig null weight to some edges ?
 

@startuml
 
folder "aaaaaaaaaaaa" {
  frame "bbbbbbbbbb" {
    node "cccccccccccccc" as c
    node "dddddddddd" as d
    node "eeeeeeeee" as e
    node "fffffffff" as f
  }
 
  frame "hhhhhhhhhhhhhhh" {
    node "iiiiiiiiiiiiii" as i
    node "jjjjjjjjjjj" as j
  }
}

folder "kkkkkkkkkkkkkk" {
  node "lllllllllllllll" as l
  node "mmmmmmmmmmmmmmmmm" as m
  node "nnnnnnnnnnnnnnn" as n
  node "ooooooooooooooooo" as o
  node "pppppppppppp" as p
}

l <--> m
m <--> c
n <--> o
o <--> c
c <--> d
m <--> e
d <---> e
o <--> f
d <---> f
p <--> i
i <--> j
j .> d

@enduml

1 Answer

0 votes
answered Apr 23, 2016 by plantuml (205,520 points)

First, there is an interesting option you can add to your diagram text: !pragma svek_trace on
With this option PlantUML creates two files : svek.dot and svek.svg. This would allow you to see the DOT source used by PlantUML to generate the diagram. If you have some Graphviz/Dot notion, it can help you to understand the behaviour of PlantUML.

For horizontal link, we use the "rank=same" feature of Graphviz. However, depending of GraphViz version, this sometimes causes Graphviz to crash when the nodes belong to different cluster. So by default, PlantUML ignores horizontal directive when nodes are in different clusters (meaning different packages/folders...). This may look as an extreme solution, we have too many crashes in the past just because of this.

However, you can disable this behaviour using one magic directive :
!pragma horizontalLineBetweenDifferentPackageAllowed

So in your case, you can have:

!pragma horizontalLineBetweenDifferentPackageAllowed
folder "aaaaaaaaaaaa" {
  frame "bbbbbbbbbb" {
    node "cccccccccccccc" as c
    node "dddddddddd" as d
    node "eeeeeeeee" as e
    node "fffffffff" as f
  }
 
  frame "hhhhhhhhhhhhhhh" {
    node "iiiiiiiiiiiiii" as i
    node "jjjjjjjjjjj" as j
  }
}

folder "kkkkkkkkkkkkkk" {
  node "lllllllllllllll" as l
  node "mmmmmmmmmmmmmmmmm" as m
  node "nnnnnnnnnnnnnnn" as n
  node "ooooooooooooooooo" as o
  node "pppppppppppp" as p
}

l <--> m
m <--> c
n <--> o
o <--> c
c <--> d
m <--> e
d <---> e
o <--> f
d <---> f
p <--> i
i <--> j
j .> d

Result is:

 

Is this what you are looking for ?

 

...