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.
Archives gérées par MHonArc 2.6.16.