[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 583: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 639: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
Gephi forums •Sigma js change label color
Page 1 of 1

Sigma js change label color

Posted: 26 Apr 2013 02:00
by louiejre
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

Posted: 26 Apr 2013 09:59
by evilefi
Quick&dirty:

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="";}}); });
Get inspired here: http://sigmajs.org/examples.html

Re: Sigma js change label color

Posted: 27 Apr 2013 01:35
by louiejre
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

Posted: 28 Apr 2013 17:49
by evilefi
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

Code: Select all

drawLabel(node)