简体   繁体   中英

D3 drawing circles on the circumference of other circle

I was trying to build a chart which is similar to here

https://sf.relsci.com/Visualizations/davos

How can i draw the circles in a circular shape?

Here is a FIDDLE with one way to do it.

.attr('transform', function (d, i) {
    return "translate(" + ((w/2-r) * Math.cos((interval*i) * Math.PI/180)) + "," + ((w/2-r) * Math.sin((interval*i) * Math.PI/180)) + ")";
});

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM