控制位图渲染
我正在尝试
- 生成一个图表,通过 Graphviz 在网站上显示。
- 使每个节点可通过图像映射(或其他一些工具)单击。
为此,我必须渲染图形
- 我应该设置什么属性来获取渲染图形的最大宽度/高度?我查看了页面 http://www.graphviz.org/doc/info/attrs。 html 并尝试操作诸如
size
之类的属性,但它似乎对我不起作用。 - 我应该如何解释节点和边的 pos 属性?
I'm trying to
- generate a graph to be displayed in a website via Graphviz.
- make each nodes clickable by imagemap (or some other tools).
To do so, I have to render the graph
- What attribute should I set to get the max width / height of the rendered graph? I looked into the page http://www.graphviz.org/doc/info/attrs.html and tried to manipulate attributes such as
size
but it didn't seem to work on me. - How should I interpret the
pos
attributes of nodes and edges?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
控制大小
正如您正确假设的那样,这可以通过修改
size
来完成。以下是一些示例:
图像尺寸:83*155px。这是默认设置下图表的大小。
图片尺寸:51*96px。图像被缩小以适合 1 英寸见方 (96 dpi)。这是预期的行为,因为文档指出:
图片尺寸:83*155px。同样符合预期的行为,图表已经小于 2 英寸,不需要缩小。
图片尺寸:103*192px。该图已按比例放大,直到其中一个尺寸等于 2 英寸。预期行为,因为文档指出:
解释节点和边的 pos 属性
我假设您的意思是 xdot 格式的 pos 值。
图形的 xdot
如下所示
节点的 pos 值指定节点位置的中心。由于图的边界框是“0,0,54,108”,因此节点位置“27,18”和“27,90”完全水平居中。
对于边缘,我猜
pos
包含边缘段的点,而_draw_
包含 B-Spline 控制点(但我对此不太确定)。Controlling the size
As you correctly assumed, this can be done by modifying
size
.Here are some examples:
Image dimensions: 83*155px. This is the size of the graph with default settings.
Image dimensions: 51*96px. The image got scaled down to fit in a 1 inch square (96 dpi). This is expected behavior because the documentation states:
Image dimensions: 83*155px. Again expected behavior, the graph is already smaller than 2 inches and does not need to be scaled down.
Image dimensions: 103*192px. The graph was scaled up to until one of the dimensions equals 2 inches. Expected behavior because the documentation states:
Interpreting pos attributes of nodes and edges
I'm assuming you mean to
pos
values of the xdot format.The xdot of the graph
is the following
The pos values of the nodes designate the center of the node position. Since the bounding box of the graph is "0,0,54,108", the node positions "27,18" and "27,90" are perfectly centered horizontally.
For edges, I guess the
pos
contains the points of the edge segments, whereas_draw_
contains the B-Spline control points (but I'm not really sure about that).