【发布时间】:2015-08-04 04:38:43
【问题描述】:
嗨,我更新了我的问题,还包括一个工作 jsfiddle,以清楚地看到我想要做什么......http://jsfiddle.net/elviz/Ge58Q/15/
nodeEnter.append("text")
.attr("dy", 3.5)
.attr("dx", 5.5)
.attr("x", barWidth +20)
.text(function(d) { return d.redirect_info; })
.on("click", function(d){
// using the value in d.redirect
//search for the node with item_id equal to d.redirect
//after finding that node input in update to draw
});
上面的代码我创建了一个文本并附加了一个 onclick 事件......如果文本是单击我想要使用 d.redirect 的值查找 item_id 等于 d.redirect 的节点然后输入更新函数中的数组来绘制树.......在我的示例中,如果文本 redirect_9_node_simple 是单击,它将从 ROOT UP TO THE NODE SIMPLE 绘制节点,如果文本 redirect_13_node_alluring 是单击我想绘制树从 ROOT 到 ALLURING 节点。请注意请向右滚动,因为文本链接在矩形右侧 20px 处
【问题讨论】:
-
信息请滚动树,因为如果链接存在,链接文本在每个节点右侧 20px 谢谢你
标签: jquery d3.js tree collapse expand