【问题标题】:D3js collapsible tree decreasing the length between nodesD3js可折叠树减少节点之间的长度
【发布时间】:2016-09-15 10:14:20
【问题描述】:

我在可折叠树中显示 json。树显示正常,但节点之间的长度应减少。请让我知道如何在 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;

同样的插件链接是:http://plnkr.co/edit/uGnQMihoHM1BU1YGPUYv?p=preview

【问题讨论】:

    标签: javascript jquery json d3.js


    【解决方案1】:

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

    【讨论】:

    • @Pradeep,你检查过我提到的那几行吗?
    猜你喜欢
    • 2013-07-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-15
    • 1970-01-01
    • 2018-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多