GraphStream Users

Archives de la liste Aide


Re: dynamic size of nodes and FileSinkImages


Chronologique Discussions 
  • From: guilhelm savin <guilhelm.savin AT gmail.com>
  • To: graphstream-users AT litislab.fr, Lao Heike <laoheike AT gmail.com>
  • Subject: Re: dynamic size of nodes and FileSinkImages
  • Date: Wed, 9 May 2012 18:29:04 +0200

Hi,

You have to use 'size-mode: dyn-size' in your CSS :

|
fsi.setStyleSheet("graph { padding: 50px; fill-color: black; }" + "node { fill-color: #3d5689; size-mode: dyn-size;}" + "edge { fill-color: white; }");
|

Then, set the size of each node using the 'ui.size' attribute :

|
| for (Node n : g)
|   n.addAttribute("ui.size", random.nextDouble() * 25 + 5);
|

It should works ...

2012/5/9 Lao Heike <laoheike AT gmail.com>
Hi (again),


I'm trying to model the dynamic of a graph in order to generate a video. So far, I managed to make a nice video thanks to graphstream (and your previous answer), but I would like to add more features.

One important feature I would like to see is the size of the node growing/shrinking depending on a given attribute of the node.

I played around with the stylesheet of the FileSinkImages. Unfortunately, I cannot access the "size" attribute of a node. It seems by default that the attributes list is empty...

When I set the size in the stylesheet of my FileSinkImages, for instance like this:
fsi.setStyleSheet("graph { padding: 50px; fill-color: black; }" + "node { fill-color: #3d5689; size: 0.1gu;}" + "edge { fill-color: white; }");

Then for a node SingleNode n = g.getNode("A"); I have:

n.getAttributeCount() is 0 and n.getAttributeKeySet() returns [].

However, it seems that all nodes in the generated images are of size 0.1gu...

How can I increase/decrease the size of the node based on some attribute in a dynamic way?

I'm aware of this tutorial: http://graphstream-project.org/doc/FAQ/The-graph-viewer/How-do-I-dynamically-change-color-and-size-in-the-viewer_1.1/

However, I want to do that based on a given attribute and for generating images.


Thanks for your help!



--
Guilhelm Savin
PhD Student of Computer Science




Archives gérées par MHonArc 2.6.16.

Top of page