Graphviz Issue Tracker
Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001801graphvizOutput Generationpublic2010-01-22 13:122011-04-28 04:03
ReporterDaniel 
Assigned Togviz 
PrioritynormalSeverityminorReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSx86-Linux-Ubuntu 9.10 (Karmic)OS Version
Summary0001801: setting the dpi attribute results in bad svg transformation
Description



When I apply the 'dpi' option of the graph with a value different from 72, the svg-output of any graphs is scaled out of view.
This results in bad results when using rsvg for post processing and also can be a problem, when displaying the resulting svg in browsers, viewers or using desktop previews.



The problem is a bad transformation generated in the main svg group <g...> ... </g> in the svg output:
the example provided by me results in a node with the text 'Hallo', when I display the the svg output in a browser (firefox) it only shows the upper left quarter of the node.
Also inkscape shows me, that the page of the output is only half height and half width of the actual group of the graph.



The problem can be seen in the group enclosing the graph in the svg output:
..
<CD>
<!-- title: G Pages: 1 -->
<svg width="156pt" height="88pt"
 viewBox="0.00 0.00 78.00 44.00" xmlns="http://www.w3.org/2000/svg" [^] xmlns:xlink="http://www.w3.org/1999/xlink"> [^]
<g id="graph0" class="graph" transform="scale(2 2) rotate(0) translate(4 40)">
<title>G</title>
</CD>
..



We can see a transform="scale(2 2)...."



This is unnecessary, as the SVG documentation states:
http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute [^]



Specifying the viewbox="..." in the line above and adjusting the width and height of the whole <svg..> </svg> is enough to get a bigger output with the 'dpi' attribute. The behaviour specified in the graphviz documentation can be achieved by manually editing the svg file to:
..
<CD>
<!-- title: G Pages: 1 -->
<svg width="156pt" height="88pt"
 viewBox="0.00 0.00 78.00 44.00" xmlns="http://www.w3.org/2000/svg" [^] xmlns:xlink="http://www.w3.org/1999/xlink"> [^]
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 40)">
<title>G</title>
</CD>
..



as it would be with dpi=72.



This problem affects anyone, who uses the same file for raster and vector output or wants to get a vector output comparable to raster output. Also affected are some automated build chains as a trac plugin.
Steps To Reproduce

digraph G {
graph [dpi=144]
Hallo
}
TagsNo tags attached.
AUXILLARY-FILES
DATE-FIXED
FIX-COMMENT 
Workarounds:
<CD>
 - don't use the dpi attribute with svg output
 - manually edit the output file
</CD>

Hints for a fix:
<CD>
 - don't change the scale attribute of the transformation in the svg output away from (1 1)
</CD>

Should be easy for someone
FORMER-ID1864
INPUT-FILE
OUTPUT-FILE
STATUS-COMMENT*
VERSION     2.20.2
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2011-04-28 04:03 user1 New Issue
2011-04-28 04:03 user1 Assigned To => user1


MantisBT 1.2.5[^]
Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker