Skip to content Skip to sidebar Skip to footer

D3.js How To Append Local Image

I have this project where I need to add local images. At this point it is possible to add images that are located on a URL using svg images and xlink:href. But the images I am usin

Solution 1:

can you try the following and see if it works:

.attr("src", function(d) {
    const imagePath = require("@/assets/img/" + d.data[2]);
    return imagePath;
  })

Solution 2:

  .attr("src", function(d) {
    return"@/assets/img/" + d.data[2];

aren't you returning the wrong src?

Post a Comment for "D3.js How To Append Local Image"