Css D3可折叠子节点围绕根节点旋转

Css D3可折叠子节点围绕根节点旋转,css,d3.js,css-transitions,css-transforms,Css,D3.js,Css Transitions,Css Transforms,如何在根节点周围的圆圈中分隔可折叠树节点?下面的图片示例。第二张图片是我现在拥有的。 我知道在这个方法中,它和X和Y的位置有关,但我不知道怎么做。 我从原始代码那里得到的 解决了。这是我的结果。 我的旋转不是使用translate,而是使用带有transform的rotate类。 否决投票的原因?以便我可以改进所提出的问题。 function update(source) { // Assigns the x and y position for the nodes var

如何在根节点周围的圆圈中分隔可折叠树节点?下面的图片示例。第二张图片是我现在拥有的。 我知道在这个方法中,它和X和Y的位置有关,但我不知道怎么做。 我从原始代码那里得到的

解决了。这是我的结果。 我的旋转不是使用translate,而是使用带有transform的rotate类。

否决投票的原因?以便我可以改进所提出的问题。
function update(source) {

    // Assigns the x and y position for the nodes
    var treeData = treemap(root);

    // Compute the new tree layout.
    var nodes = treeData.descendants(),
        links = treeData.descendants().slice(1);
    debugger
    // Normalize for fixed-depth.

    nodes.forEach(function (d) {
        //i know i have to do something here
        d.y = d.depth * 180;

    });

// Transition to the proper position for the node
//then it will update the transform and translate
enter code here
    nodeUpdate.transition()
        .duration(duration)
        .attr("transform", function (d) {
            return "translate(" + d.y + "," + d.x + ")";
        });