Sunday 12 March 2017

same image is loading for all svg circle

here i used the svg pattern for image but all circles are loading same image

<svg id="mySvg" width="80" height="80">
<defs id="mdef">
<pattern id="image" x="0" y="0" height="40" width="40">
<image id="img" x="0" y="0" width="40"  
height="40"xlink:href="pics/2.jpg"></image>
</pattern>
</defs>


var nodes = svg.selectAll("circle")// master code
.data(dataset.nodes)
.enter()
.append("circle")
.attr("class", "logo")
.attr("cx", 225)
.attr("cy", 225)
.attr("r", 20)
.style("fill", function (d) { $('#img').attr('href', d.url); return "url(#image)"; })
.call(force.drag);



via sayed israr

No comments:

Post a Comment