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