I use prefuse to visualise (directed) graphs. In my visualisations I want to have edges with just a forward arrow AND edges without arrows . I tried many things found in the docs, but failed. Either all edges have a forward arrow or none.
I configure the visualizqtion with
EdgeRenderer er = new EdgeRenderer(Constants.EDGE_TYPE_CURVE, Constants.EDGE_ARROW_FORWARD);
EdgeRenderer erNoArrow = new EdgeRenderer(Constants.EDGE_TYPE_LINE, Constants.EDGE_ARROW_NONE);
// includes straight line edges for EdgeItems by default
DefaultRendererFactory drf = new DefaultRendererFactory(r);
drf.add(new InGroupPredicate(EDGE_DECORATORS), new LabelRenderer(VisualItem.LABEL));
drf.add(new InGroupPredicate("noArrow"), erNoArrow);
Edges are created with
Edge e = mygraph.addEdge(from, to);
e.setString(VisualItem.LABEL, "a label");
e.setString("arrowtype", "noArrow"); // this however does not work
How should I created edges to use either the "er" or "erNoArrow" EdgeRenderer ?
Thank you very much in advance
Best you create a datafield "arrowtype" on your edge table.
Then the e.setString("arrowtype", "noArrow"); is ok.
The predicate (or expressionparser.parse, can't remember) must be different, not ingroup but like "arrowtype == noArrow". Can't remember exactly, sorry, but examples should be around on this forum.
Best regards, Björn
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.