简体   繁体   English

D3在另一个圆的圆周上绘制圆

[英]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 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. 这是具有一种实现方式的FIDDLE

.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. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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