GraphStream Users

Archives de la liste Aide


Re: Graphstream and Icons


Chronologique Discussions 
  • From: guilhelm savin <guilhelm.savin AT gmail.com>
  • To: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>, Dennis Krauß <denniskrauss AT hotmail.de>
  • Subject: Re: Graphstream and Icons
  • Date: Tue, 25 Nov 2014 17:25:35 -0500

Hi Denis, and welcome,

You have to load the advanced viewer. You should add the new fill-mode only in the specified classes, else the viewer will try to load an image for each node. Here is an example :

import org.graphstream.graph.Graph;
import org.graphstream.graph.implementations.DefaultGraph;



public class Icons {
public static void main(String...strings) throws Exception {
System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
String styleSheet = "node {size: 100px;}"
 + "node.fun {fill-image: url('./fun.jpg'); fill-mode: image-scaled;}"
 + "node.dull {fill-image: url('./head.png'); fill-mode: image-scaled;"
 + "}";
Graph g = new DefaultGraph("g");
g.addAttribute("ui.stylesheet", styleSheet);
g.addNode("A").addAttribute("ui.class", "fun");
g.addNode("B").addAttribute("ui.class", "dull");
g.addNode("C");
g.addEdge("AB",  "A",  "B");
g.addEdge("AC",  "A",  "C");
g.addEdge("BC",  "B",  "C");
g.display();
}
}

Hope it helps !
Cheers

Guilhelm

2014-11-22 14:09 GMT-05:00 Dennis Krauß <denniskrauss AT hotmail.de>:
Hello GraphStream-Users,

at first i want to apologize for my bad english (im german).
I need some help to use icons on my graph. To be exact i need two things
1) Icons as nodes
2) Icons beside the nodes

so i need the things shown in the first and last picture at the top row from following tutorial:
http://graphstream-project.org/doc/Tutorials/Graph-Visualisation_1.0/#viewers


I think i have to write a stylesheet like
 
String styleSheet = "node {size: 100px; fill-mode: image-scaled;}"
  + "node.fun {fill-image: url('fun.gif');}"
  + "node.dull {fill-image: url('images/head.png');"
+ "}"
;

but somehow i dont get it running. i never get icons -.-
could one of you show me an examlpe with icons for both of my variants?

Thanks!



--
Guilhelm Savin
PhD of Computer Science



Archives gérées par MHonArc 2.6.16.

Top of page