我正在使用 Collapsible search tree .我需要在每次新搜索时删除节点之间链接的彩色笔划。
如何去掉之前搜索链接的彩色笔画?
我试图删除我们在新搜索的 openPaths(paths)
函数中设置的 path.link.class
。但它不起作用。
最佳答案
您需要添加它来清除每个圆圈上的红色类,如下所示。
$("#search").on("select2-selecting", function(e) {
var paths = searchTree(root,e.object.text,[]);
if(typeof(paths) !== "undefined"){
d3.selectAll("circle").style("fill", function(d) {
d.class="";//clear the class of all circles.
});
openPaths(paths);
}
else{
alert(e.object.text+" not found!");
}
})
工作代码here
希望这对您有所帮助!
关于javascript - d3 可折叠搜索树 - 在每次搜索时删除旧的 stokes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33999076/