bindings.js ------------------------
//Functions that will be used as bindings
function expandEvent (params) { // Expand a node (with event handler)
if (params.nodes.length) { //Did the click occur on a node?
var page = params.nodes[0]; //The id of the node clicked
expandNode(page);
}
}
expandNode("shrek");
//
var testData = []; //keep track over every node that has been clicked on
//Functions that will be used as bindings
function expandEvent (params) { // Expand a node (with event handler)
if (params.nodes.length) { //Did the click occur on a node?
var page = params.nodes[0]; //The id of the node clicked
expandNode(page);
testData.push(page);
}
}
//
//Reset the color of all nodes, and width of all edges.
function resetProperties() {
if (!isReset) {
selectedNode = null;
//Reset node color
var modnodes = tracenodes.map(function(i){return nodes.get(i);});
colorNodes(modnodes, 0);
//Reset edge width and color
var modedges = traceedges.map(function(i){
var e=edges.get(i);
e.color=getEdgeColor(nodes.get(e.to).level);
return e;
});
edgesWidth(modedges, 1);
tracenodes = [];
traceedges = [];
tracenodes = ['aldi','argo','lidl']; //testData;
traceedges = [];
//traceedges = [];
//Color nodes yellow
var modnodes = tracenodes.map(function(i){return nodes.get(i);});
colorNodes(modnodes, 1);
//Widen edges
var modedges = traceedges.map(function(i){
var e=edges.get(i);
e.color={inherit:"to"};
return e;
});
edgesWidth(modedges, 5);
}
}
//Highlight the path from a given node back to the central node.
function traceBack(node) {
if (node != selectedNode) {
selectedNode = node;
resetProperties();
tracenodes = getTraceBackNodes(node);
traceedges = getTraceBackEdges(tracenodes);
tracenodes = ['aldi','argo','lidl']; //testData;
traceedges = [];
//traceedges = [];
//Color nodes yellow
var modnodes = tracenodes.map(function(i){return nodes.get(i);});
colorNodes(modnodes, 1);
//Widen edges
var modedges = traceedges.map(function(i){
var e=edges.get(i);
e.color={inherit:"to"};
return e;
});
edgesWidth(modedges, 5);
}
}