Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

landscape mode support? #207

Open
hemanthactionfi opened this issue Nov 29, 2021 · 1 comment
Open

landscape mode support? #207

hemanthactionfi opened this issue Nov 29, 2021 · 1 comment
Labels

Comments

@hemanthactionfi
Copy link

is lanscape mode support avaliable?
the following graph fails without any error

<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script type="text/javascript" src="https://d3js.org/d3.v5.min.js"></script>
<script src="https://unpkg.com/@hpcc-js/wasm@0.3.11/dist/index.min.js"></script>
<script src="https://unpkg.com/d3-graphviz@3.0.5/build/d3-graphviz.js"></script>
<div id="graph" style="text-align: center;"></div>
<script>

d3.select("#graph").graphviz()
    .renderDot('digraph { landscape=true  a -> b }');
</script>

if we remove landscape=true it works just fine

@magjac magjac added the bug label Dec 4, 2021
@magjac
Copy link
Owner

magjac commented Dec 4, 2021

Thanks for the report. You've found a bug. Landscape mode uses the rotate transform function in the transform SVG attribute which d3-graphviz currently cannot handle.

This command:

echo "digraph { landscape=true  a -> b }" | dot -Tsvg

renders:

<?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 2.49.4~dev.20211103.0228 (20211103.0228)
 -->
<!-- Pages: 1 -->
<svg width="116pt" height="62pt"
 viewBox="0.00 0.00 116.00 62.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(-90) translate(-58 112)">
<polygon fill="white" stroke="transparent" points="-4,4 -4,-112 58,-112 58,4 -4,4"/>
<!-- a -->
<g id="node1" class="node">
<title>a</title>
<ellipse fill="none" stroke="black" cx="27" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-86.3" font-family="Times,serif" font-size="14.00">a</text>
</g>
<!-- b -->
<g id="node2" class="node">
<title>b</title>
<ellipse fill="none" stroke="black" cx="27" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-14.3" font-family="Times,serif" font-size="14.00">b</text>
</g>
<!-- a&#45;&gt;b -->
<g id="edge1" class="edge">
<title>a&#45;&gt;b</title>
<path fill="none" stroke="black" d="M27,-71.7C27,-63.98 27,-54.71 27,-46.11"/>
<polygon fill="black" stroke="black" points="30.5,-46.1 27,-36.1 23.5,-46.1 30.5,-46.1"/>
</g>
</g>
</svg>

@magjac magjac changed the title lanscape mode suppot? landscape mode support? Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants