【发布时间】: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