I have peculiar problem when I tried to offset the edge label in my Jung2 network.
As shown in figure below the label causes the self loop difficult to see.
So I decided to offset the label:
vv.getRenderContext().setLabelOffset(20);
And the Effect:
Offset is effective for all the edges except for the edge that I need: the self loop. Anyone has a solution or a workaround ?
EDIT:
Does anyone know what the EdgeLabelClosenessTransformer does? And how to use it? This may solve my problem.
vv.getRenderer().getVertexLabelRenderer().setEdgeLabelClosenessTransfomer();
UPDATE:
I tried this, but the self loop label is unaffected.
vv.getRenderContext().setEdgeLabelClosenessTransformer(
new Transformer<Context<Graph<Node, Edge>, Edge>, Number>() {
/**
* @see Transformer#transform(Object)
*/
public Number transform(
Context<Graph<Node, Edge>, Edge> context) {
Graph<Node, Edge> graph = context.graph;
Edge e = context.element;
return e.getCloseness();
}
});