GraphStream Users

Archives de la liste Aide

Re: CSS styles not adding

Chronologique Discussions 
  • From: Antoine Dutot <antoine.dutot AT>
  • To: graphstream-users AT, Filippo Bistaffa <filippo.bistaffa AT>
  • Subject: Re: CSS styles not adding
  • Date: Mon, 21 Nov 2011 13:19:24 +0100

Hi Filippo,

I guess this is due to the following problem: the attribute that stores the stylesheet is a single character string, therefore it is replaced when you change it. However the viewer stores a StyleSheet object that can read the updates of this attribute, and it is this object that merges the changes. Therefore you have to create the viewer before doing the changes on the attributes, so that both changes are communicated to the viewer (i.e. place the g.display() before the two g.addAttribute("ui.stylesheet"..)). Else only the last value stored in the "ui.stylesheet" string is considered by the viewer that has no way to know what was the old value.

I hope this is the error you encounter, if this is not the case, could you send a larger program so that I can try to reproduce the error, it could be a bug in the viewer,


2011/11/20 Filippo Bistaffa <filippo.bistaffa AT>
Hi to all, I have an issue using CSS styles. From what I've read in the documentation, the CSS styles should be cumulative, so if I do something like:

g.addAttribute("ui.stylesheet", "node { fill-color: green; }");
g.addAttribute("ui.stylesheet", "graph { fill-color: red; }");

I should see the background red AND the nodes green. Instead of the intended result, I only see the background red.
If I invert the order of the two instructions, I see the nodes green, but the background is in the default color. 
It seems that the styles are not merged, but the old one is completely discarded and the new one is applied.

  • CSS styles not adding, Filippo Bistaffa, 20/11/2011
    • Re: CSS styles not adding, Antoine Dutot, 21/11/2011

Archives gérées par MHonArc 2.6.16.

Top of page