var treeData = {"name" : "首頁", "info" : "tst", "size": 3938, "url": "/", "children" : [
{"name" : "佈告欄", "size": 3938, "url": "/bulletin"},
{"name" : "課程公告", "size": 3938, "url": "/course"},
{"name" : "會議資訊", "size": 3938, "url": "/meeting"},
{"name" : "檢定考試", "size": 3938, "url": "/certified"},
]};
// 將 node 加入 a 標籤,並取用 url 屬性內容 node.append("svg:a").attr("xlink:href", function(d) { return d.url; }) .append("svg:text").text(function(d) { return d.name; });
Reference :
d3.js Tree: most simple sample | The JavaDude Weblog
Hyperlinks in d3.js objects - Stack Overflow
javascript - d3.js tree structure text links - Stack Overflow
沒有留言:
張貼留言