SigmaJS how to filter dynamic labels?

130 Views Asked by At

In sigmajs we can define our own filter by using for example:

return n.label === "JavaScript";

In this way if we are useing the nodesBy function we can get all nodes with label of "JavaScript" only.

If we need to show multiple labels, we may user "or" operator for example:

return n.label === "JavaScript" || n.label === "C++";

So in this way both nodes with "JavaScript" and "C++" can be shown.

However, if I don't know how many labels I need to show, how can I do the return?

If I have a dynamic list of labels, and it could be changed. How can I do the return?

I want to make the user be able to change the labels he/she wants to show, so the label list is dynamic.

The online tutorial: https://github.com/jacomyal/sigma.js/tree/master/plugins/sigma.plugins.filter

Thanks so much.

1

There are 1 best solutions below

0
On

If you have a dynamic list of label, you can create some dynamic functions for the filter plugin.

So I don't see your problem ...

What have you try so far ?

Cheers