« Previous - - Next »

[prefuse] how to extend Graph dataset

5 July 2007

prefuse.Visualization is not good because it has Graph and Tree depending codes. I have confesed about “m_vis.add("tree", g);“. Graph or Tree depending codes should be implemented at extend of prefuse.Visualization like prefuse.GraphVisualization.

Anyway, I found a way to extend Graph dataset.

1. create new Table, and add data to the Table.

Table tb = new Table();
tb.addColumn("key", int.class, new Integer(-1));
tb.addColumn("text", String.class, "[No Message]");

Tuple t = tb.getTuple(tb.addRow());
t.set("key", i);
t.setString("text", "sample message");

2. create Graph and put Table to the Graph.

Graph g = new Graph(true);
g.addSet("message", tb);

3. add Graph and Table to Visualization.

vis = new Visualization();

vis.add("tree", g);
vis.add("message", g.getSet("message"));

Posted in programming | Trackback | del.icio.us | Top Of Page

No comments yet

Leave a Reply