phylotree.js
phylotree.js copied to clipboard
Filter all branches with button instead of using brush
Hello there,
I just started using phylotree js. However, alongside the tree-selection
using 'brush' features. I want to be able to make the same selection using a click-on button to select all branches (i.e on clicking the select all button, I should select all branches with the dotted lines as shown in the pics).
(achieved the selection in the above picture by using the brush feature)
Currently, when I make the selection, it selects the branches with the bold lines using the implementation from html file
. Below is the code.
$(".select-unselect-mode").on ("change", function (e) { if ($(this).is(':checked')) { if ($(this).data ("mode") == "select") { console.log('i am working') tree.modify_selection (function (d) { return true;}); } else { console.log('i am working 2') tree.modify_selection (function (d) { return false;}); } } });
I will appreciate any help on how to make the selection with the dotted lines using the button instead of the brush features.
Dear @Sombiri,
Sorry for the delay responding.
You want to call something like
//select all
rendered_tree.modifySelection (_.map (rendered_tree.links.filter(rendered_tree.edgeVisible), (e)=>e.target),"tag", true, false, "true");
//unselect all
rendered_tree.modifySelection (_.map (rendered_tree.links.filter(rendered_tree.edgeVisible), (e)=>e.target),"tag", true, false, "false");
Best, Sergei