GraphStream Users

Archives de la liste Aide


Re: dynamically computing ui attributes based on other attributes


Chronologique Discussions 
  • From: Antoine Dutot <antoine.dutot AT gmail.com>
  • To: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>, "Mularz, Diane E." <mularz AT mitre.org>
  • Subject: Re: dynamically computing ui attributes based on other attributes
  • Date: Thu, 3 Apr 2014 17:20:48 +0200

Hi Diane,

2014-04-02 17:02 GMT+02:00 Mularz, Diane E. <mularz AT mitre.org>:

I am reviewing the material on graphStream’s ui and have a question about dynamically setting ui attributes.

 

For instance, I want to set the size of a node based on its edge count.  That value isn’t known until the graph is constructed.  In the viewer-basics documentation I see an example where an edge’s color is set based on the value stored in its maximum speed attribute.  But the stylesheet has been setup apriori to a range of color values.  When using the edge count for a node, this range wouldn’t be know apriori.  

 

In the case where I want to assign a color attribute to an edge based on the value of another edge attribute at creation time I can see that I can create a style class for each edge attribute and then add the ui attribute after I create the referenced attribute:  

 

In stylesheet:

edge.x {size:2px; stroke-color:red, stroke-width:1px;stroke-mode:plain);

 

In code:

edge.addAttribute(“x”, valueOfX);

edge.addAttribute("ui.class", "x");

 

But what if I want to set the width of the edge based on its attribute “weight” and that value isn’t known until the edge is created?


You cannot ask GraphStream to automatically map an attribute to another. You will have to browse the graph and change edge attributes by yourself. Probably the best way to do this is to put an element sink on the graph to listen at edge creation.
 

Also, where can I find a complete description of stylesheet options?



Regards 
 

Regards,

 

Diane Mularz

Systems Software Engineer

Performance Speciality

The MITRE Corporation

Modeling & Simulation Technical Center

7515 Colshire Dr.

McLean, VA 22102

mularz AT mitre.org

GoogleScholarCitation

703.983.5598(work)

703.983.6435(fax)

 

No element should function merely as a vehicle to extricate oneself from the mire of indecision

 

Ring the bells that still can ring

Forget your perfect offering

There is a crack in everything

That’s how the light gets in

-          Leonard Cohen

 





Archives gérées par MHonArc 2.6.16.

Top of page