Results 1 to 1 of 1
- 11-06-2012, 01:05 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 2
- Rep Power
- 0
Prefuse Visualization add Node to another graph
Hi I have been coding Java for a while but new to graphics.
I am using the Prefuse Visualization library, and am successfully adding nodes to a graph.
I have laid out 4 JPanels, northWest (NW) NE, SW, SE. When I click on a node in NW, I want that node to be added (copied) into NE. Thats the bigger picture.
So 4 JPanels as mentioned. 4 graphs, called graphNW, graphNE etc etc.
I am adding data to graphNW from a CSV.
I create a common Visualization (vis).
I set up where to place the JPanels.
I then pass graphNW, graphNE to a method. this then calls:
This creates a display from vis. It adds pan/draw/zoom controllers to the display, and finally a ControlListener to handle what to do when the display is clicked on. This is passed the graph graphNE and vis.Java Code:northWest.add(createDisplay(graphNE , vis));
When the graph is clicked:
the console shows that the number of nodes on the graph is increasing with each clickJava Code:if (item instanceof NodeItem) { addNewNode(item, graph); system.out.println(graph.getNodeCount()); }
In other words when a Node is clicked in graphNW, a new node is added to graphNE, that is equal to the current node.
however currently this isnt currently what happens. What I see is an exact replicor in graphNE of graphNW always. Then no new nodes appear when I click on one in graphNW. I think it is to do with the way the visualization is setup - it takes all of its properties from graphNW - and is then used by graphNE to create the display, however I didnt think I would need a new visualization for every graph?
rather I would want it so that when a node is clicked in a certain graph, that told its parent object, and that handled what to do with this information.
Any ideas what I might be doing wrong?
Thanks
Alex
Similar Threads
-
Problem casting from org.w3c.dom.Node to my subclass of Node
By msphelix in forum Advanced JavaReplies: 1Last Post: 08-12-2012, 03:15 AM -
Drawing a arc and node graph using a correlation matrix
By jetnor in forum New To JavaReplies: 2Last Post: 03-20-2011, 07:20 PM -
Graph Visualization
By GeoffG in forum New To JavaReplies: 3Last Post: 08-04-2009, 02:00 PM -
Graph - Breadth First search for searching a node ?
By JavaInLove in forum Advanced JavaReplies: 1Last Post: 10-06-2008, 10:17 PM -
Data Visualization
By jafaryj in forum New To JavaReplies: 0Last Post: 11-28-2007, 06:16 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks