How to append images as node in forced graph d3

Viewed 14

I am trying to append image as node in forced graph using d3. But its only showing in case of circles

Here is the working code

  const link = svg
   .append("g")
   .attr("stroke", "#999")
   .attr("stroke-opacity", 0.6)
   .selectAll("line")
   .data(links)
   .join("line")
   .attr("stroke-width", d => Math.sqrt(d.value));



  const node = svg
   .append("g")
   .attr("stroke", "#0002fb")
   .attr("stroke-width", 2)
   .selectAll("circle")
   .data(nodes)
   .join("circle")
   .attr("r", 12)
   .attr("fill", color)
  .call(drag(simulation));

How to render images as node.

0 Answers
Related