サイズの異なるノードを持つ強制有向グラフがあります。2 つのノードを接続する各パスの途中にカスタム アイコンを表示したいと考えています。d3 の例から、ノード内に画像を表示する方法を見つけました。ただし、パスで同じ手法を試すと、画像が表示されません。
var path = svg.append("svg:g").selectAll("path").data(force.links());
var pathEnter = path.enter().append("svg:path");
pathEnter.attr("class", function(d) {
return "link " + d.target.type;
})
pathEnter.append("svg:g").append("image")
.attr("xlink:href","http://127.0.0.1:8000/static/styles/images/add.png")
.attr("x",0).attr("y",0).attr("width",12).attr("height", 12)
.attr("class", "type-icon");