Skip to content

Commit

Permalink
show only nodes that are bigger than average size of all nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmdrz committed Mar 7, 2019
1 parent b41330b commit 7ad91a8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion static/index.html
Expand Up @@ -67,12 +67,20 @@

var nodes = {};
var json = JSON.parse(this.responseText);
var averageSize = 0;
json.nodes.forEach(function (node) {
if (node.size < 10) {
averageSize += node.size;
});
averageSize /= json.nodes.length;
json.nodes.forEach(function (node) {
if (node.size < averageSize) {
return;
}
nodes[node.id] = true;
node.color = colors.nodes.dark;
node.x *= 2;
node.y *= 2;
node.size *= 2;
s.graph.addNode(node);
});
json.edges.forEach(function (edge) {
Expand Down

0 comments on commit 7ad91a8

Please sign in to comment.