i am appending svg images to chart.But sometime the image source may not exists. In order to avoid the situation, i have replace the un existing image with default one.
g.selectAll("image")
.data(data)
.enter()
.append("svg:image")
.attr("xlink:href",function(d){
return d.name+".jpg";
})
.attr("x", function (d,i) { return x(d.x); } )
.attr("y", function (d,i) { return y(100); } )
.attr("width",imageSize)
.attr("height",imageSize);
suppose d.name+".jpg" not present in directory. I have to replace it by default.jpg.
how can i do that??
Thanks in advance.