summaryrefslogtreecommitdiff
path: root/src/client/view/graph_view.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-03-24 17:26:42 +0200
committerAlon Levy <alon@pobox.com>2015-03-24 17:26:42 +0200
commite3cff6a365a2f3d1b93959bd1abd863e518e7857 (patch)
tree2d0f77f05244e58aa1f69b1e0e1f501b214a987f /src/client/view/graph_view.js
parent4218f8fdf7c47ce8b8baa8f6fd2b95f1d93f358a (diff)
client/graph_view: add link distance depending on degree of node
Diffstat (limited to 'src/client/view/graph_view.js')
-rw-r--r--src/client/view/graph_view.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js
index cb7ba020..7a3a61f4 100644
--- a/src/client/view/graph_view.js
+++ b/src/client/view/graph_view.js
@@ -989,6 +989,13 @@ function GraphView(spec) {
.distance(240)
.gravity(0.12)
.charge(-1800)
+ .linkDistance(function (link, i) {
+ var d_src = graph.degree(link.__src),
+ d_dst = graph.degree(link.__dst),
+ ret = (d_src + d_dst) * 10 + 10;
+ console.log(d_src + ', ' + d_dst + ', ' + ret);
+ return ret;
+ })
.size([w, h])
.on("tick", pushRedraw)
.on("end", record_position_to_local_storage)