これは私を馬鹿にしています:(私はD3を使ってsvg文書を生成してから、それをphantomJsでレンダリングし、.svgとして出力します。次のようにコードでD3 - append( 'foreignObject')は、テキストとtspan要素を追加するだけです。
、私はforeignObject
を生成しています:
svg.select("#def-commit") .append('foreignObject') .attr('width', 100) .attr('height', 100) .attr('x', 50) .attr('y', 50) .attr('requiredFeatures','http://www.w3.org/TR/SVG11/feature#Extensibility') .append('xhtml:p') .text("a big chunk of text that should wrap");
を今奇妙なことは、生成された文書は、すべてのDOMにforeignObject
ノードを持たないことである代わりに、。それはtext
とネストされたtspan
です。同様に:
<g xmlns="http://www.w3.org/2000/svg" id="def-commit"> <circle r="15" cx="0" cy="0"/> <text xmlns="http://www.w3.org/1999/xhtml"><tspan style="font-size: 11.5pt; font-family: "sans-serif";" x="0" y="14.5">a big chunk of text that should wrap</tspan> </text> </g>
何が欠けていますか?
その他の情報: D3 - 最新 - 3.5.16 SVG宣言ので
<svg xmlns:xhtml="http://www.w3.org/1999/xhtml" id="mermaidChart0" width="1200" height="904.0178571428571" style="width: 1192; height: 904.0178571428571;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">