【问题标题】:D3 Collapsible child nodes going around root node in circlesD3 可折叠的子节点绕着根节点绕圈
【发布时间】:2019-12-27 06:46:37
【问题描述】:

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

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 + ")";
        });

【问题讨论】:

  • 拒绝投票的原因?以便我可以改进所提出的问题。

标签: css d3.js css-transitions css-transforms


【解决方案1】:

解决了。这是我的结果。 而不是为我的旋转使用翻译。我使用带有变换的旋转类。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-21
    • 1970-01-01
    • 2019-03-29
    • 2018-12-10
    相关资源
    最近更新 更多