I have a Donut Chart with 3 categories (arcs): Facebook (50%), Twitter(30%) and Instagram(20%). Plot the chart is fairly easy, but I want to know how to insert an icon in each arc with the respective symbol of the social network (using D3 or even C3).
Thanks!
Adding an image is just a case of using
You'll also need to position (
x
andy
). These will default to 0, so you could alternatively make use of atranslate
, something like this to find the center of the arc:However, that just anchors the image's top-right corner to the centre of the arc, so to properly centre it you need to use the size of the image. Here's the full thing:
Here's an example: http://jsfiddle.net/henbox/88t18rqg/6/
Note that I've included the image paths in the chart data. You just need to go and find proper icons!