Guru

unread,

Mar 18, 2008, 4:03:58 AM3/18/08

to Flex Visual Graph Library

Hi,

I am trying to create Graph nodes manually, but the graph is not
getting refreshed. Can you please tell me how to refresh the graph
after adding/removing nodes. Here is the code i am using

public function addNodeXML(xml:XML):void{

if(graph == null){
graph = new
org.un.flex.graphLayout.data.Graph("XMLAsDocsGraph",false,null,null);
}
var isEmpty:Boolean = (startRoot == null &&
graph.nodes.length == 0);
if(isEmpty){
rootNodeXML = xml;
rootNodeXML.@isroot = "true";
}

var obj:Object = xml.localName();
var name:Object = xml.name();
if(obj == "Node"){
graph.createNode(xml.@id,xml);
}else{
var fromNode:INode = graph.nodeByStringId(xml.@fromID);
var toNode:INode = graph.nodeByStringId(xml.@toID);
graph.link(fromNode,toNode,xml);
}
if(vgraph.graph == null){
vgraph.graph = graph;
vgraph.initFromGraph();

layouter = new ParentCenteredRadialLayouter(vgraph);
vgraph.layouter = layouter;
layouter.autoFitEnabled = true;
vgraph.edgeRenderer = new DefaultEdgeRenderer;
vgraph.maxVisibleDistance = 1000;
vgraph.newNodesDefaultVisible = true;
vgraph.autoLayout = true;
}
}

Thanks
Gireesh

JB

unread,

Mar 19, 2008, 10:05:44 PM3/19/08

to Flex Visual Graph Library

Gireesh,

You'll notice in vgExplorer there is a refresh button; also take note
of the refresh when selecting/deselected show edge labels. A refresh
function is triggered which may accomplish what you are looking for.
Check the source vgExplorer.mxml for these functions.

JB

Reply all

Reply to author

Forward