我被一个非常简单的 d.3 问题困住了。我有与父子关系的节点。我正在尝试创建一个场景,在该场景中,我将单击除父节点之外的所有节点
我可能在想这样的事情?
.on(click, function(node){
if(!= node.parent){
window.location = d.url;
}
})
这显然不起作用。这个的语法是什么?
这就是返回的 json 的样子。这将让我了解我如何看待什么是父母和什么是孩子
functiongetNodes(){
varinNodes={
"name": "Test App",
"dept": "NYC",
"children": [
{
"name": "HPD Data Feeds",
"dept": "Third Party",
"category": "API",
"size": 15,
"url": "http://nycpdev.localhost:8082/api/hpd-data-feeds"
},
{
"name": "DOT Data Feeds",
"dept": "Third Party",
"category": "API",
"size": 15,
"url": "http://nycpdev.localhost:8082/api/dot-data-feeds"
},
{
"name": "HPD Data Feeds",
"dept": "Third Party",
"category": "App",
"size": 15,
"url": "http://nycpdev.localhost:8082/api/hpd-data-feeds"
}
],
"size": 20,
"url": "app/113"
};returninNodes;
}