8

I'm trying to find a way to have an image inside a circle in D3 and a text next to it.

I'm using force directed graph if it makes any difference.

So far i can find only partial solutions (only image, only text, only circle), but non that combines them all.

Any idea?

VividD
  • 10,456
  • 6
  • 64
  • 111
Or A
  • 1,789
  • 5
  • 29
  • 55
  • 1
    [This](http://stackoverflow.com/questions/19202450/adding-an-image-within-a-circle-object-in-d3-javascript/19204833#19204833) question might help with adding the image to a circle, having the text next to it is pretty standard, you'll just need to chain them together. – user1614080 Nov 20 '13 at 05:02
  • [This question](https://groups.google.com/forum/#!topic/d3-js/fL8_1BLrCyo) may also help. – Lars Kotthoff Nov 20 '13 at 09:13

1 Answers1

6

Can this example help? http://bl.ocks.org/mbostock/950642

The related code is here:

node.append("image")
      .attr("xlink:href", "https://github.com/favicon.ico")
      .attr("x", -8)
      .attr("y", -8)
      .attr("width", 16)
      .attr("height", 16);
derek
  • 9,358
  • 11
  • 53
  • 94