09-06-2007, 07:18 AM
This demo shows how to add data "manually" to a graph, should mean not reading the data from a file.
More or less a cut down of the AggregateDemo of the prefuse download.
The steps which create the graph:
(Additional hint: Please notice that in this minimalistic demo the node color doesn't change at the mouse hover event, so the "draw" ColorAction doesn't need to be included in the infinite active "animate" action. Still all interaction with the graph like zoom, pan and and drag work fine since these are working on the display and not on the visualization level. Check the AggregateDemo source code to see the difference for the case of more active node coloring, which works on the visualization level. If you haven't yet don't miss to memorize the prefuse toolkit structure documentation, which is an essential prerequisite in order to get a delighted prefusian)
More or less a cut down of the AggregateDemo of the prefuse download.
The steps which create the graph:
Code:
Graph g = new Graph();
g.addColumn("label", String.class);
Node n1 = g.addNode();
Node n2 = g.addNode();
Node n3 = g.addNode();
n1.setString("label","self");
n2.setString("label","arisen");
n3.setString("label","graph");
g.addEdge(n1, n2);
g.addEdge(n1, n3);
m_vis.addGraph(GRAPH, g);(Additional hint: Please notice that in this minimalistic demo the node color doesn't change at the mouse hover event, so the "draw" ColorAction doesn't need to be included in the infinite active "animate" action. Still all interaction with the graph like zoom, pan and and drag work fine since these are working on the display and not on the visualization level. Check the AggregateDemo source code to see the difference for the case of more active node coloring, which works on the visualization level. If you haven't yet don't miss to memorize the prefuse toolkit structure documentation, which is an essential prerequisite in order to get a delighted prefusian)
