First of all, let me thank you all for the great library that this is. It has helped me a lot.
I’m relatively new to this library and this is my first time using it, so I am sorry in advance on anything that might have been obvious.
I have the following dot file:
digraph Workflow {
rankdir=TB;
ValidateDescription [ label=ValidateDescription, style=filled, fillcolor=lightcyan, color=black ];
SendEmail [ label=SendEmail, style=filled, fillcolor=honeydew ];
end [ label=end, style=filled, fillcolor=honeydew ];
}
I would like to export this as SVG. When I try to run the following command dot -Tsvg -Gsize=10,10\! -Gscale=1 -Eminlen=1 graph.dot -o output.svg
I get the following invalid SVG:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 9.0.0 (20230911.1827)
-->
<!-- Title: Workflow Pages: 1 -->
<svg width="200pt" height="720pt"
viewBox="0.00 0.00 0.14 720.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(0.000354945 0.000354945) rotate(0) translate(4 2028480.51)">
<title>Workflow</title>
<polygon fill="white" stroke="none" points="4,4 4,2028480.51 396.61,2028480.51 396.61,4 4,4"/>
<!-- ValidateDescription -->
<g id="node1" class="node">
<title>ValidateDescription</title>
<ellipse fill="lightcyan" stroke="black" cx="92.38" cy="-1014238.26" rx="92.38" ry="18"/>
<text text-anchor="middle" x="92.38" y="-1014230.21" font-family="Times,serif" font-size="14.00">ValidateDescription</text>
</g>
<!-- SendEmail -->
<g id="node2" class="node">
<title>SendEmail</title>
<ellipse fill="honeydew" stroke="black" cx="261.38" cy="-1014238.26" rx="59.04" ry="1014238.26"/>
<text text-anchor="middle" x="261.38" y="-1731395.7" font-family="Times,serif" font-size="14.00">SendEmail</text>
</g>
<!-- end -->
<g id="node3" class="node">
<title>end</title>
<ellipse fill="honeydew" stroke="black" cx="365.38" cy="-1014238.26" rx="27.22" ry="1014019.22"/>
<text text-anchor="middle" x="365.38" y="-1731240.82" font-family="Times,serif" font-size="14.00">end</text>
</g>
</g>
</svg>
It looks like dot
is calculating completely wrong the positions. The weird part is if I remove the end
node, everything works and two nodes are rendered:
digraph Workflow {
rankdir=TB;
ValidateDescription [ label=ValidateDescription, style=filled, fillcolor=lightcyan, color=black ];
SendEmail [ label=SendEmail, style=filled, fillcolor=honeydew ];
}
The following SVG is correctly rendered:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 9.0.0 (20230911.1827)
-->
<!-- Title: Workflow Pages: 1 -->
<svg width="720pt" height="103pt"
viewBox="0.00 0.00 720.00 102.84" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(2.33729 2.33729) rotate(0) translate(4 40)">
<title>Workflow</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-40 304.05,-40 304.05,4 -4,4"/>
<!-- ValidateDescription -->
<g id="node1" class="node">
<title>ValidateDescription</title>
<ellipse fill="lightcyan" stroke="black" cx="92.38" cy="-18" rx="92.38" ry="18"/>
<text text-anchor="middle" x="92.38" y="-9.95" font-family="Times,serif" font-size="14.00">ValidateDescription</text>
</g>
<!-- SendEmail -->
<g id="node2" class="node">
<title>SendEmail</title>
<ellipse fill="honeydew" stroke="black" cx="251.38" cy="-18" rx="48.67" ry="18"/>
<text text-anchor="middle" x="251.38" y="-9.95" font-family="Times,serif" font-size="14.00">SendEmail</text>
</g>
</g>
</svg>
I have tried playing with several arguments but nothing seems to work. What am I doign wrong to convert this to SVG?
Thank you all for the help.
/app $ dot --version
dot - graphviz version 9.0.0 (20230911.1827)