Question

Why does this graphml file below does not render the node color properly in PREFUSE?

<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns">
<graph edgedefault="undirected">
<key id ="color" for="node" attr.name="color" attr.type="String">
<default>pink</default>
</key>
<key id="name" for="node" attr.name="name" attr.type="string">
<default>hey</default>
</key>
<node id="7534">
<data key="color">green</data>
<data key="name">hey!</data>
</node>
</graph>
</graphml>

Thanks

Was it helpful?

Solution

AFAIK prefuse does not set the node color automatically. It treats color like any other field.

Try using a DataColorAction:

ColorAction color = new DataColorAction(
    PrefuseLib.getGroupName("data", Graph.NODES), 
    "color", Constants.NOMINAL, VisualItem.FILLCOLOR, palette);

Note, that you still need to set int[] palette according to your colors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top