I know it's there're a few topics that discuss the issue but non of the found results worked for me. I'm trying to modify the classic d3 network graph Les miserables example (d3v4 version HERE: https://bl.ocks.org/mbostock/4062045) to add different images for different nodes - the relative path of the file being given as one of the node attributes, eg.
{"id": "Valjean", "group": 1, img: "images/male.png"},
What I'm trying to achieve is similar to this:https://bl.ocks.org/mbostock/950642 but made in d3v4, and different images for different nodes.
All examples that I found (also this promissing code snippet, which unfortunately doesnt't work for me) point me to similar approach, which looks more or less like this(both in d3 v4 and v3):
node.append("image")
.attr("xlink:href", function(d) { return d.img })
.attr("x", -8)
.attr("y", -8)
.attr("width", 16)
.attr("height", 16);
However, despite a few hours spent I can not make it work. Any ideas?