Forums

Full Version: Multiple LabelRenderers on an Edge
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to show multiple values on an edge in a graph visualization.

Say I have 3 nodes. A Decision node, and 2 other nodes.

The decision node points to the two other nodes in the graph, with some probability of reaching the other node.

Decision.Node ==> Node.1 [decision.probability=20%, decision.name="go"]
Decision.Node ==> Node.2 [decision.probability=80%, decision.name="stop"]

On my visualization, I am using the edge decorator to draw the {decision.probability} value onto my edge. I used the same patterns illustrated in the AggregateDecoratorDemo.

Now, this works great when showing 1 of the values along the edge. Using the patterns in the example I can show probability OR name.

ie:
Code:
DefaultRendererFactory defaultRendererFactory = new DefaultRendererFactory(nodeRenderer);
        defaultRendererFactory.add(new InGroupPredicate(EDGE_DECORATORS), new LabelRenderer(
            "probability"));

However, say I try to add another label renderer to the factory
Code:
defaultRendererFactory
            .add(new InGroupPredicate(EDGE_DECORATORS), new LabelRenderer("name"));

Now it still only renders probability. How can I make both of these renderers show up. Maybe the name above the line, and the probability below? Any thoughts?
Reference URL's