d3.js符号而不是圆圈

时间:2013-06-21 04:20:46

标签: d3.js geometry symbols

我使用下面的代码来创建SVG圈子,并且工作正常。

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

现在我想使用自定义符号而不是圆圈。我在bmp文件中有这些符号。

请指导我如何做到这一点。

由于 克里希纳

1 个答案:

答案 0 :(得分: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);
相关问题