GraphStream Users

Archives de la liste Aide


Re: Request about Graphstream project


Chronologique Discussions 
  • From: Antoine Dutot <antoine.dutot AT gmail.com>
  • To: Bastien Michel <bastien.michel AT insa-rouen.fr>, graphstream-users AT litislab.fr
  • Cc: julien.baudry AT graphstream-project.org, antoine.dutot AT graphstream-project.org, yoann.pigne AT graphstream-project.org, guilhelm.savin AT graphstream-project.org
  • Subject: Re: Request about Graphstream project
  • Date: Tue, 15 Nov 2011 11:35:42 +0100

Hello Bastien,

There are two viewers in GraphStream, the basic one does not allows edge shapes other than lines. You have to download the advanced viewer (gs-ui module on the download page), put it in the class path, and enable it globally like this is described here.

Hope this helps,

Best regards,

Antoine

2011/11/15 Bastien Michel <bastien.michel AT insa-rouen.fr>
Hello,

I send you this mail to enquire some information about using style to customize "Graph", "Nodes" and "Edges".

In fact, we create a stylesheet and basically apply this by the method "addAttribute()". Unfortunately, all the specifications of the style are applied except for the shape property for the edges.

Please, find the following code :

===================================== CODE ==============================================

import javax.swing.JFrame;
import org.graphstream.ui.graphicGraph.GraphicGraph;
import org.graphstream.ui.swingViewer.Viewer;

        String stylesheet = "graph { fill-color: white;}"
        stylesheet += "node { shape: box; size: 20px; fill-color: red;}";
        stylesheet += "edge { fill-color: blue; shape: cubic-curve;}";
       
        GraphicGraph graph = new GraphicGraph("GraphicGraph");

        Viewer viewer = new Viewer(graph, Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
        viewer.disableAutoLayout();
       
        graph.addAttribute("ui.quality");
        graph.addAttribute("ui.antialias");

        graph.addAttribute("ui.stylesheet", stylesheet);
       
        graph.addNode("A");
        graph.addNode("B");
        graph.addNode("C");
       
        graph.addEdge("AB", "A", "B", false);
        graph.addEdge("BC", "B", "C", true);
        graph.addEdge("CA", "C", "A", false);
       
        viewer.enableAutoLayout();
       
        JFrame frame = new JFrame("GraphicGraph");
        frame.setContentPane(viewer.addDefaultView(false));
        frame.pack();
        frame.setSize(800,800);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

================================== END OF CODE =========================================


The result is visible on the following screenshot :




As you can see, the shape style doesn't work with this method. I hope there is a mistake in the proposed code and you have a way to do that.

You will be most helpful,

Best regards,

MICHEL Bastien
CARTON Antoine

Engineer Students at INSA Rouen.



  • Re: Request about Graphstream project, Antoine Dutot, 15/11/2011

Archives gérées par MHonArc 2.6.16.

Top of page