user3619753
user3619753

Reputation: 3

add image as background to text d3.js

I am using this example: http://bl.ocks.org/robschmuecker/7880033. I want to add image before each node text and also have different font-style to each node.

Thanks in advance.

Upvotes: 0

Views: 331

Answers (1)

fasouto
fasouto

Reputation: 4511

I haven't tested it but this may work:

 nodeEnter.append("svg:image")
     .attr('width', 20)
     .attr('height', 20)
     .attr("xlink:href","img/myimage.png");

Add it to the 'update' function, once nodeEnter is created.

Upvotes: 1

Related Questions