I have a problem using the SpecifiedLayout in Prefuse. I want to set some nodes in positions that are already predefined. I have tried using the AxisLayout. The nodes are set into the right position, but then I can´t really use the options of DragControl or ZoomControl. So I have tried using the SpecifiedLayout. The problem here is that all nodes are set into the same position and not into the positions I specified in the beginning. Hope somebody can help me with this problem.
Here is the code:
private static Visualization vis;
graph = new Graph();
graph.addColumn("positionx", Integer.class);
graph.addColumn("positiony", Integer.class);
Then I add the predefined positions to "positionx" and "positiony". Afterwards:
ActionList layout = new ActionList(ActionList.INFINITY);
SpecifiedLayout l = new SpecifiedLayout("graph.nodes","positionx","positiony");
layout.add(l);
layout.add(new RepaintAction());
vis.putAction("layout", layout);
As I said, if I use the AxisLayout instead of the SpecifiedLayout:
layout.add(new AxisLayout("graph.nodes","positionx",Constants.X_AXIS));
layout.add(new AxisLayout("graph.nodes","positiony",Constants.Y_AXIS));
the nodes are set to the right position, but dragging and zooming is not possible.
I would really appreciate any help.
Thx
What do you mean when you say dragging and zooming are not possible with AxisLayout? As long as you add a DragControl and a ZoomControl dragging and zooming should work.
For Example:
Does that work for you?