D3js可折叠树减少了节点之间的长度 [英] D3js collapsible tree decreasing the length between nodes

查看:111
本文介绍了D3js可折叠树减少了节点之间的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在可折叠树中显示json.该树显示良好,但应缩短节点之间的长度.请让我知道如何在d3js中执行此操作.

I am displaying the json in collapsible tree. The tree is displaying fine but the length between the nodes should be reduced. Please let me know how to do this in d3js.

 var treeData = {
      "name": "test",
      "description": "sdfdsfdf",
      "children": [
        {
          "name": "test",
          "description": "test",
          "children": [
            {
              "name": "test",
              "description": "dfdsfdsfdf"
            },
            {
              "name": "truetest",
              "description": "status check",
              "children": [
                {
                  "name": "variable test",
                  "description": "variable test"
                },
                {
                  "name": "variable test",
                  "description": "variable test"
                }
              ]
            },
            {
              "name": "uuuu",
              "description": "trest",
              "destination": "10.154.130.1"
            }
          ]
        }
      ]
    }
        var totalNodes = 0;
        var maxLabelLength = 0;
        // variables for drag/drop
        var selectedNode = null;
        var draggingNode = null;
        // panning variables
        var panSpeed = 200;
        var panBoundary = 20; // Within 20px from edges will pan when dragging.
        // Misc. variables
        var i = 0;
        var duration = 750;
        var root;

同一个插件的链接是: p =预览

The plunker link for the same is: http://plnkr.co/edit/uGnQMihoHM1BU1YGPUYv?p=preview

推荐答案

链接的高度和宽度分别在dndTree.js文件的355行和函数363-368行中设置.

Height and width of links are set on line 355 and in the function on lines 363-368 of dndTree.js file, respectively.

这篇关于D3js可折叠树减少了节点之间的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆