@cryptotaxi247 / kubo / commits / a2cee3f16

diagnostics/d3: added # of conns

Juan Batiz-Benet committed Jan 14, 2015 at 10:29 UTC a2cee3f165dd7c2b77447f95a8fea9b599d08ed0
2 files changed +7 -4
diagnostics/d3/chord.html
+6 -3
@@ -47,15 +47,15 @@ d3.json(hash, function(error, data) {
47 .attr("transform", function(d) { return "rotate(" + (d.x - 90 + rotate) + ")translate(" + d.y + ")"; })
48
49 node.append("svg:circle")
50 - .attr("r", function(d) { return 4; })
51 - .style("fill", function(d, i) { return color(i % 3); })
50 + .attr("r", function(d) { return 6; })
51 + .style("fill", function(d, i) { return color(i % 20); })
52
53 node.append("text")
54 .attr("dx", function(d) { return 8; })
55 .attr("dy", ".31em")
56 // .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
57 // .attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; })
58 - .text(function(d) { return d.name; });
58 + .text(function(d) { return d.conns + " - " + d.name; });
59
60 var p = projection
61 var link = svg.selectAll(".link")
@@ -99,6 +99,7 @@ function parseGraph(graph2) {
99 graph2.nodes.forEach(function(data, i) {
100 data.y = innerRadius
101 data.x = ((360 / graph2.nodes.length) * i)
102 + data.conns = 0
103 graph.nodes.push(data)
104 graph.byName[data.name] = data
105 })
@@ -106,6 +107,8 @@ function parseGraph(graph2) {
107 graph2.links.forEach(function(link) {
108 var source = graph2.nodes[link.source]
109 var target = graph2.nodes[link.target]
110 + source.conns++
111 + target.conns++
112
113 var mid = curveNode(source, target)
114 graph.mids.push(mid)
diagnostics/d3/d3view
+1 -1
@@ -9,7 +9,7 @@ hash=$(ipfs add -q "$file" </dev/null | tail -n1)
9
10 # this viewer is the hash of go-ipfs/diagnostics/d3/viewer.html
11 force="QmaY6Lq9MEhDfWUc1VfHcu9aLWSyvi4VDLvWQXLoVZ4Mau"
12 -chord="QmVGcat7ieYqf8mwcvwACbJstCRH8m8k2Yyt2qhuFEMoAz"
12 +chord="QmYWjPa736Bk7FhNEEtWLjaEdioSxXkYMhRT9tLi45ccm7"
13 viewer="$chord"
14
15 # the ipfs gateway to use