Hello i try to filter the nodes of my graph base on the value of one input(working with angular ts). The main functionality is working properly but there is an exception. I have group of nodes and there are few cases that one node is connected with another node of different group, here is my graph initially:
here is the code that i filter the nodes when input value is given:
this.updateSubject.subscribe((val: any) => {
this.diagram.startTransaction()
this.diagram.commit((diag) => {
diag.nodes.each((n: any) => {
if(['subscription', 'resourcegroup'].includes(n.data.groupType)) {
return;
}
n.visible = n.data.label.includes(val)
});
}, 'Filtered');
this.diagram.commitTransaction()
})
The if statement is to prevent the hiding of the 2 type of groups, but no matter what the value of the input is, the result is to hide all the nodes of the graph correct but the links of the nodes that are between different groups are not getting lost.
Here are two examples with the filtering:
-
input value: master
-
input value to filter all nodes
In general nodes are hiding from the graph correct with their links, but not sure why when one link starts from a node of a different group it stays and moves to the group edges.