implemented generation of network map of address history, not finished

This commit is contained in:
arnaucode
2017-07-27 13:57:05 +02:00
parent 568bd6af46
commit f9262f72a1
12 changed files with 401 additions and 144 deletions

View File

@@ -13,16 +13,19 @@ angular.module('app.network', ['ngRoute'])
$scope.data = [];
$scope.nodes = [];
$scope.edges = [];
var nodes, edges, container;
$scope.selectedNode = {};
var nodes, edges, container, network;
var options = {
layout: {
improvedLayout: false
},
interaction: {
hover: true
},
physics: {
stabilization: false,
//enabled: false
}
/*,
physics:{
//stabilization: false,
// enabled: false
}*/
};
@@ -35,7 +38,28 @@ angular.module('app.network', ['ngRoute'])
nodes: nodes,
edges: edges
};
var network = new vis.Network(container, data, options);
network = new vis.Network(container, data, options);
network.on("click", function(params) {
params.event = "[original event]";
//$scope.selectedNode = JSON.stringify(params, null, 4);
$scope.selectedNode = params;
console.log($scope.selectedNode);
console.log($scope.selectedNode.nodes);
var options = {
// position: {x:positionx,y:positiony}, // this is not relevant when focusing on nodes
scale: 1,
offset: {
x: 0,
y: 0
},
animation: {
duration: 500,
easingFunction: "easeInOutQuad"
}
};
network.focus($scope.selectedNode.nodes[0], options);
//console.log('click event, getNodeAt returns: ' + this.getNodeAt(params.pointer.DOM));
});
};
$http.get(urlapi + 'map')
@@ -50,4 +74,20 @@ angular.module('app.network', ['ngRoute'])
console.log('data error');
});
$scope.focusNode = function(node) {
var options = {
// position: {x:positionx,y:positiony}, // this is not relevant when focusing on nodes
scale: 1,
offset: {
x: 0,
y: 0
},
animation: {
duration: 500,
easingFunction: "easeInOutQuad"
}
};
network.focus(node.id, options);
};
});