3
我使用下面的代码来创建SVG圆圈,并且工作正常。d3.js符号而不是圆圈
nodeEnter.append("svg:circle")
.attr("r", 1e-6)
.attr("id", function(d) {return d.name; })
现在我想使用自定义符号而不是圆圈。我在bmp文件中有这些符号。
请指导我如何做到这一点。
感谢 克里希纳
我使用下面的代码来创建SVG圆圈,并且工作正常。d3.js符号而不是圆圈
nodeEnter.append("svg:circle")
.attr("r", 1e-6)
.attr("id", function(d) {return d.name; })
现在我想使用自定义符号而不是圆圈。我在bmp文件中有这些符号。
请指导我如何做到这一点。
感谢 克里希纳
我认为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);
它的工作,谢谢。 – krisho