Персональные инструменты
 

Graphviz SVG/DPI problems

Материал из CustisWiki

Перейти к: навигация, поиск

Consider following simple graph «d.dot»:

 digraph G{ rankdir=TB; size="7,6";
  black ->goldenrod1 [color=goldenrod1]
 }

[svg]

The problems appers with:

  • Graphviz version >"2.2"
  • SVG-output
  • Nonstandard (>96) «Dpi» parameter.

Graphviz 2.2 - correct, all ok

If we run

c:/app/graphviz22/Graphviz/bin/dot.exe -Tsvg -o example-graphviz-22.svg -Gdpi=192 d.dot

When we have «example-graphviz-22.svg»:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
 "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- Generated by dot version 2.2.1 (Thu Apr  7 19:37:52 UTC 2005)
     For user: Bill Gates   Title: G    Pages: 1 -->
<svg width="300px" height="360px"
 viewBox = "-1 -1 99 119"
 xmlns="http://www.w3.org/2000/svg">
<g id="graph0" class="graph" style="font-family:Times-Roman;font-size:14.00;">
<title>G</title>
<g id="node1" class="node"><title>black</title>
<ellipse cx="49" cy="22" rx="29" ry="18" style="fill:none;stroke:black;"/>
<text text-anchor="middle" x="49" y="27">black</text>
</g>
<g id="node3" class="node"><title>goldenrod1</title>
<ellipse cx="49" cy="94" rx="44" ry="18" style="fill:none;stroke:black;"/>
<text text-anchor="middle" x="49" y="99">goldenrod1</text>
</g>
<g id="edge2" class="edge"><title>black&#45;&gt;goldenrod1</title>
<path style="fill:none;stroke:#ffbe25;" d="M49,40C49,48 49,57 49,66"/>
<polygon style="fill:#ffbe25;stroke:#ffbe25;" points="53,66 49,76 46,66 53,66"/>
</g>
</g>
</svg>

Which looks like:

Graphviz 2.4, 2.6, 2.8 - incorrect

If we run graphviz (>=2.4 - we test 2.4, 2.6, 2.8)

c:/app/graphviz24/Graphviz/bin/dot.exe -Tsvg -o example-graphviz-24.svg -Gdpi=192 d.dot

When we have «example-graphviz-24.svg»:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
 "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
 <!ATTLIST svg xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">
]>
<!-- Generated by dot version 2.4 (Wed Jul 20 20:45:32 UTC 2005)
     For user: Bill Gates -->
<!-- Title: G Pages: 1 -->
<svg width="696px" height="840px"
 viewBox = "0 0 261 315"
 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" style="font-family:Times-Roman;font-size:14.00;">
<title>G</title>
<!-- black -->
<g id="node1" class="node"><title>black</title>
<ellipse style="fill:none;stroke:black;" cx="131" cy="62" rx="29" ry="18"/>
<text text-anchor="middle" x="131" y="75">black</text>
</g>
<!-- goldenrod1 -->
<g id="node3" class="node"><title>goldenrod1</title>
<ellipse style="fill:none;stroke:black;" cx="131" cy="254" rx="44" ry="18"/>
<text text-anchor="middle" x="131" y="267">goldenrod1</text>
</g>
<!-- black&#45;&gt;goldenrod1 -->
<g id="edge2" class="edge"><title>black&#45;&gt;goldenrod1</title>
<path style="fill:none;stroke:#ffbe25;" d="M131,110C131,131 131,155 131,179"/>
<polygon style="fill:#ffbe25;stroke:#ffbe25;" points="141,179 131,206 123,179 141,179"/>
</g>
</g>
</svg>

Which looks like:

Bug

Bug registered and fixed. http://www.graphviz.org/bugs/b958.html