Grid layout for nodes in a package

+3 votes
asked Oct 11, 2013 in Wanted features by scooper (440 points)

Components layout in a nice grid fasion, however, nodes do not. Nodes just go left-to-right.

I'm generating lots of diagrams like the following, and the fact that all the nodes just layout left to right makes viewing the diagram difficult.

 

package "Package" {
node node1  {
[component1-1]
[component1-2]
[component1-3]
}
node node2  {
[component2-1]
[component2-2]
[component2-3]
}
node node3  {
[component3-1]
[component3-2]
[component3-3]
}
node node4  {
[component4-1]
[component4-2]
[component4-3]
}
}
commented Oct 18, 2013 by mbucc (300 points)
Implementing the graphviz aspect parameter would help constrain the horizontal layout to be more vertical.

http://plantuml.sourceforge.net/qa/?qa=1226/does-plantuml-expose-graphviz-ratio-setting&show=1231#c1231

2 Answers

0 votes
answered Oct 14, 2013 by plantuml (294,960 points)
selected Mar 11, 2014 by scooper
 
Best answer


In the following beta, we have added some grid layout capability for nodes.
https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

We really don't know if we will keep this in the official release, because there might be too many hacks here.
The real issue is that GraphViz has not been designed to draw grid. It has been designed to draw graph.

So the right solution would be to have a dedicated layout engine in PlantUML for that.
(That's what we have already done for sequence diagram and for activity diagram beta).
This will be done some day, but not in short term. Sorry about that.

In between, just tell us if the beta version is working for you (probably not), and send us examples of non-working diagrams. We will see if we could do something by hacking graphviz.

commented Oct 14, 2013 by scooper (440 points)
That actually does help somewhat. Aside for the occasional stack trace. It's not perfect, but it is better.
commented Nov 22, 2013 by scooper (440 points)
Turns out that the stack traces were because my version of graphviz was out of date. Using a newer version of graphviz generates diagrams which look a lot better.
Thanks for implementing this!
0 votes
answered Oct 12, 2013 by plantuml (294,960 points)
Graphviz/dot does not support grid layout. Actually, PlantUML emulates such a layout by defining some invisible link between component.

We could have grid of nodes, but this will only work if no link at all are defined in the diagram (like in your example). Would this be ok for you ?
commented Oct 13, 2013 by scooper (440 points)
Unfortunately, I need to have links between components. I don't have many, but I do have them. I've noticed that the links between components doesn't really help the layout - it's still left-to-right.
...