简体   繁体   English

可折叠树D3的边缘

[英]Edges for Collapsible tree D3

I am having some issues with the edges for the collapsible tree in D3. 我在D3中的可折叠树的边缘存在一些问题。 I have tried swapping the x and y positions and was able to move the nodes but not the edges? 我尝试过交换x和y位置,并且能够移动节点但不能移动边缘? I tried to swap the x0 and y0 but still not working? 我试图交换x0和y0,但仍然无法正常工作?

      // Enter any new links at the parent's previous position.
    link.enter().insert("path", "g")
      .attr("class", "link")
      .attr("d", function(d) {
        var o = {x: source.x0, y: source.y0};
        return diagonal({source: o, target: o});
      });

http://jsfiddle.net/6FkBd/383/

You had to change this values of x and y too. 您也必须更改x和y的值。 Check this one out http://jsfiddle.net/6FkBd/394/ var diagonal = d3.svg.diagonal() .projection(function(d) { return [dx, dy]; }); 检查一下这个http://jsfiddle.net/6FkBd/394/ var diagonal = d3.svg.diagonal() .projection(function(d) { return [dx, dy]; });

By the way, I think we both working on same thing, I am trying to create OrgChart that will support collapsing/expanding. 顺便说一句,我想我们俩都在做同样的事情,我试图创建支持折叠/扩展的OrgChart。 But not being lucky yet. 但是还不幸运。

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

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