Hi I am trying to add a background image on svg rectangle. But unfortunately I am not able to see the image in the rectangle's background. My code snippet is
rectCanvas_o = parentElement.append("rect");
rectCanvas_o.attr("width", "30").attr("height","100%").
attr("class", this.currentAlarmClass_s);
rectCanvas_o.append("defs").append("pattern").
attr("width", 20).attr("height", 20).
attr('patternUnits', 'userSpaceOnUse').append("image").
attr("width", 20).attr("height", 20).
attr("xlink:href", "image.png");
I also able to see my code in as html in chrome debugger as
<rect width="30" height="100%" class="eq__NEcontainer__currentAlarmAction">
<defs>
<pattern width="20" height="20" patternUnits="userSpaceOnUse">
<image width="20" height="20" xlink:href="image.png"></image>
</pattern>
</defs>
</rect>
But no background image is seen. Image location is proper. Any help would be appreciated. Thanks