2016-07-03 2 views
0

私はD3コードを持っています。D3 - 生のシンボルを追加

"そのまま" svgシンボルを追加したいと思います! D3 svgに転送します。

私はD3を使用してシンボルを動的に作成したくありません。シンボルは既にデザイナーから作成されていますので、そのまま使用したいと思います!

これは私のjsfiddleです:https://jsfiddle.net/omriman12/8786e8zq/1/私はD3コンテナpie_chart_wrapperを持っていると私はちょうどあなたのSVGに以前definded記号を追加D3のSVG

答えて

3

にシンボルmd_fileを追加したいフィドルで

追記 useヨーヨー後
svg.append("g") 
    .attr("transform","translate(0,0)") 
    .attr("class","mySymbol") 
    .append("use") 
    .attr("xlink:href","#md_file") 

Here the working code

urは次のように属性を調整できます。

svg.append("g") 
    .attr("transform","translate(0,0)") 
    .attr("class","mySymbol") 
    .append("use") 
    .attr("width",20) 
    .attr("heigth", 20) 
    .style("fill", "red") 
     . 
     . 
     . 
    .attr("xlink:href","#md_file") 
+1

thx alot、working – omriman12

関連する問題