[英]Graphviz grid alignment
I'm trying to generate layout information for a graph where all of the elements must be laid out in a grid. 我正在尝试为必须在网格中布置所有元素的图形生成布局信息。 I would like all coordinates to be integer multiples of the grid-box size.
我希望所有坐标为网格框大小的整数倍。
For example, if I have a grid made up of 1 inch squares, I would like all node coordinates to be a multiple of 72 (the number of points in an inch, if I'm not mistaken). 例如,如果我有一个由1英寸正方形组成的网格,我希望所有节点坐标都是72的倍数(如果我没记错的话,以英寸为单位的点数)。 I like the hierarchical layout of dot, so if possible, that's the tool I'd like to use.
我喜欢点的分层布局,因此,如果可能的话,这就是我要使用的工具。
I've looked over the element attribute list several times, and I haven't figured out how to do this. 我已经多次查看了元素属性列表 ,但还没有弄清楚该如何做。
Edit: 编辑:
The reason I've chosen GraphViz is that it can perform layout, then return that information as text. 我选择GraphViz的原因是它可以执行布局,然后将该信息作为文本返回。 Other tools seem to just want to render a graph, but I want to render it elsewhere, and I just need to get the layout information.
其他工具似乎只想渲染图形,但我想在其他地方渲染图形,我只需要获取布局信息。
I believe the Graph::Easy perl module can be used to layout dot files into grids. 我相信Graph :: Easy perl模块可用于将点文件布局到网格中。
http://bloodgate.com/perl/graph/manual/index.html http://bloodgate.com/perl/graph/manual/index.html
http://search.cpan.org/~tels/Graph-Easy/bin/graph-easy http://search.cpan.org/~tels/Graph-Easy/bin/graph-easy
Edit: 编辑:
I'm not sure if this is your desired output, but by playing with the column width of the nodes I can produce: 我不确定这是否是您想要的输出,但是通过玩节点的列宽可以产生:
+------------------+
| A |
+------------------+
| |
| |
v v
+------------++----+
| A1 || A2 |
+------------++----+
| |
| |
v v
+-----++-----+
| A1B || A1A |
+-----++-----+
graph { flow: down; }
[ A ] {columns: 8;}
[ A ] -> { start: south; end: north; } [ A1 ]
[ A ] -> { start: south; end: north; } [ A2 ]
[ A1 ] -> { start: south; end: north;} [ A1A ]
[ A1 ] -> { start: south; end: north;} [ A1B ]
Also I believe it is possible to set the exact space on the grid that the node sits. 我也相信可以在节点所在的网格上设置确切的空间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.