0
我在可摺疊樹中顯示json。樹顯示正常,但節點之間的長度應減少。請讓我知道如何在d3js中做到這一點。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;
的plunker鏈路對於相同的是:http://plnkr.co/edit/uGnQMihoHM1BU1YGPUYv?p=preview
@Pradeep,你檢查了我提到的幾行嗎? – elias