Data Presentation
Data can be converted to Qunee element objects. After graphic components are added, view presented effect:
var graph = new Q.Graph("canvas");
function onDataCollected(txt){
var json = JSON.parse(txt);
translateToQuneeElements(json);
graph.moveToCenter();
}
function translateToQuneeElements(json){
if(json.nodes){
Q.forEach(json.nodes, toQuneeNode);
}
if(json.edges){
Q.forEach(json.edges, toQuneeEdge);
}
}
request("./data-server", "", onDataCollected);
Operation effect
Automatic layout
In addition, for topological data without position information, the automatic layout of nodes can be
completed by using automatic layout. Such as usage of spring layout
var layouter = new Q.SpringLayouter(graph);
layouter.start();