I have to display the images in circles.I tried the code available in stack overflow but it doesn't work for me image .I tried using svg pattern. I tried using nodeEnter.append("image") and nodeEnter.append("circle") also but getting squares images only. Many thanks in advance.
function update() {
var nodes = flatten(root),
links = d3.layout.tree().links(nodes);
force.nodes(nodes).links(links).start();
link = link.data(links, function(d) { return d.target.id; });
link.exit().remove();
link.enter().insert("line", ".node")
.attr("style", function(d) { if(d.target.strength==1){ return "stroke:Red"; } else if(d.target.strength==2) { return "stroke:Green"; } else if(d.target.strength==3) { return "stroke:yellow"; }
else return "stroke:Blue" })
.attr("class", "link");
node = node.data(nodes, function(d) { return d.id; });
node.exit().remove();
var nodeEnter = node.enter().append("g").attr("class", "node").on("click", click).on("mouseover", showDetails)
.on("mouseout", hideDetails).call(force.drag);
nodeEnter.append("svg:image")
.attr("xlink:href", function(d){ return d.imgUrl;})
.attr("x", -10)
.attr("y", -10)
.attr("width", 32)
.attr("height", 32);
//.attr("radius", function(d) { return Math.sqrt(d.size) / 10 || 15; });
node.select("circle").style("fill", color);
}