How to filter links dynamically in vis.js

3.3k Views Asked by At

Is there a way to filter links and nodes in vis.js network?
I have set a DataSet for both nodes and edges like so:

function drawNetwork(container){
     var nodes = new vis.DataSet();
     populateNodes(nodes); // code ommited for bravity
     var edges = new vis.DataSet();
     populateEdges(edges); // code ommited for bravity

     var data = {
                nodes: nodes,
                edges: edges
            };

     // create the network
     var options = {...}
     var network = new vis.Network(container, data, options);
}

Thanks.

1

There are 1 best solutions below

0
Ankush Dharkar On

You should be able to filter the DataSet using the filtering functions described at http://visjs.org/docs/data/dataset.html#Data_Filtering

Once you get your filtered data, set that as the graph to be viewed.