Sigma js change label color
-
- Posts:4
- Joined:26 Mar 2013 01:33 [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Anyone know how to change label color/font dynamically? For example, when mouse over a node, change label color to red or increase font size. Thanks.
Re: Sigma js change label color
Quick&dirty:
Get inspired here: http://sigmajs.org/examples.html
Code: Select all
sigma.instances[1].bind('overnodes', function(event){ sigma.instances[1].iterNodes(function(node){if(node.id==event.content){node.color="red";}}); });
sigma.instances[1].bind('outnodes', function(event){ sigma.instances[1].iterNodes(function(node){if(node.id==event.content){node.color="";}}); });
-
- Posts:4
- Joined:26 Mar 2013 01:33 [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Re: Sigma js change label color
Thank you for the reply. Your code only works with node color, but I was looking for ways to change label colors. I can change the defaultLabelColor property, but it will affect all labels, and change is not dynamic. "label" is a node property, but label color or font is not. I hope someone can point me to the right direction. Thanks.
Re: Sigma js change label color
Hi.
As you can see here https://github.com/jacomyal/sigma.js/bl ... er.js#L361 the color node property is the only way to modify the filling via node property (if the drawingProperties are set accordingly).
If you need more you I fear you will have to change the implementation of
As you can see here https://github.com/jacomyal/sigma.js/bl ... er.js#L361 the color node property is the only way to modify the filling via node property (if the drawingProperties are set accordingly).
If you need more you I fear you will have to change the implementation of
Code: Select all
drawLabel(node)