mstefaniuk / graph-viz-d3-js

Graphviz web D3.js renderer
MIT License
313 stars 38 forks source link

Node labels containing double backslash doesn't render #47

Closed magjac closed 7 years ago

magjac commented 7 years ago

The following DOT code does not render any node label:

digraph G { "Test" [label = "hello\\world"] }

The output is:

diagram

Inspecting the generated svg shows no text node:

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 119.12 44" height="44pt" width="119.12pt">
  <style type="text/css">.dashed {stroke-dasharray: 5,5} .dotted {stroke-dasharray: 1,5} .overlay {fill: none; pointer-events: all}</style>
  <g>
    <g transform="translate(4,40)">
      <polygon stroke="#fffffe" stroke-opacity="0" fill="#ffffff" points="-4,4 -4,-44 119.12,-44 119.12,4"></polygon>
      <g class="node">
        <title>Test</title>
        <path stroke="#000000" fill="none" d="M 55.56,-18 m -55.62,0 a 55.62,18 0 1,0 111.24,0 a 55.62,18 0 1,0 -111.24,0"></path>
      </g>
    </g>
  </g>
</svg>

It works with Graphviz:

$ echo 'digraph G { "Test" [label = "hello\\world"] }' | dot -Tsvg
<?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.36.0 (20140111.2315)
 -->
<!-- Title: G Pages: 1 -->
<svg width="110pt" height="44pt"
 viewBox="0.00 0.00 110.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>
<polygon fill="white" stroke="none" points="-4,4 -4,-40 106,-40 106,4 -4,4"/>
<!-- Test -->
<g id="node1" class="node"><title>Test</title>
<ellipse fill="none" stroke="black" cx="51" cy="-18" rx="51.0191" ry="18"/>
<text text-anchor="middle" x="51" y="-14.3" font-family="Times,serif" font-size="14.00">hello\world</text>
</g>
</g>
</svg>