2013-06-21 140 views
3

我使用下面的代碼來創建SVG圓圈,並且工作正常。d3.js符號而不是圓圈

nodeEnter.append("svg:circle") 
.attr("r", 1e-6) 
.attr("id", function(d) {return d.name; }) 

現在我想使用自定義符號而不是圓圈。我在bmp文件中有這些符號。

請指導我如何做到這一點。

感謝 克里希納

回答

3

我認爲this example是你在尋找什麼:

有趣的代碼是:

nodeEnter.append("image") 
    .attr("xlink:href", "https://github.com/favicon.ico") //should work with bmp 
    .attr("x", -8) 
    .attr("y", -8) 
    .attr("width", 16) 
    .attr("height", 16); 
+0

它的工作,謝謝。 – krisho