4
我是d3.js的新手,不確定使用哪個d3功能。d3.js使用極座標的繪圖元素
我需要將一組元素放置在一個原點(圓圈)上。
svg.selectAll('circle').each(function() {
d3.select(this)
.attr('cx', r * Math.cos(theta))
.attr('cy', r * Math.sin(theta));
theta += thetaInc;
});
因此,不要像上面的代碼那樣做一些乏味的事情,那麼做到這一點的d3簡短方法是什麼?