img is an HTML tag, and the graph you're building is SVG. Once you start working inside of a svg tag on a page, you're dealing with SVG elements, not HTML elements.

You can, though,

  1. Put HTML inside of SVG by using the foreignObject tag
  2. Use the SVG equivalent of the img tag, which is the image tag

Related Query

More Query from same tag