I guess I’m still having a hard time understanding d3 syntactically. I was going to use a background-image from a flag class and then the subimages would have background-positions, but adding an img with a class as in:
var nodesDrawn = d3
.select("#container")
.selectAll(“img”)
.data(nodesData)
.enter()
.append(“img”)
.attr(‘class’, function(d){return “flag flag-”+d.code;})
;
which produces images, but doesn’t work with the force graph… force nodes without lines
Alternatively I have produced the graph itself, and do have nodes that work, but can’t use images instead of svg circles… force links without nodes
var nodesDrawn = svg
.append(“g”)
.selectAll(“img”)
.data(nodesData)
.enter()
.append(“img”)
.attr(‘class’, function(d){return “flag flag-”+d.code;})
;
And you can see that with links but not nodes, I’m trying to append the nodes to an svg, whereas the images are being appended to the body directly. Can anyone help me understand how this works?