Skip to content

Commit a14d77e

Browse files
committed
diagnostics/d3: node sizes
1 parent 4af5d85 commit a14d77e

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

diagnostics/d3/chord.html

+30-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
<meta charset="utf-8">
33
<style>
44

5+
body {
6+
font: 11px "Helvetica Neue", Helvetica, Arial, sans-serif;
7+
}
8+
59
.node {
610
font: 11px "Helvetica Neue", Helvetica, Arial, sans-serif;
711
}
@@ -12,8 +16,27 @@
1216
fill: none;
1317
}
1418

19+
#legend {
20+
position: fixed;
21+
top: 10px;
22+
left: 10px;
23+
font-size: 14px;
24+
background: rgba(255, 255, 255, 0.7);
25+
}
26+
27+
#legend h1 {
28+
font-weight: 200;
29+
margin: 0px;
30+
padding: 0px;
31+
}
32+
1533
</style>
1634
<body>
35+
<div id="legend">
36+
<h1>IPFS TestNet</h1>
37+
<a href="http://ipfs.io">ipfs.io</a> - <span id="node-count"></span> nodes
38+
</div>
39+
1740
<script src="http://d3js.org/d3.v3.min.js"></script>
1841
<script>
1942
var hash = window.location.hash.substring(1)
@@ -47,7 +70,7 @@
4770
.attr("transform", function(d) { return "rotate(" + (d.x - 90 + rotate) + ")translate(" + d.y + ")"; })
4871

4972
node.append("svg:circle")
50-
.attr("r", function(d) { return 6; })
73+
.attr("r", function(d) { return d.conns + 3; })
5174
.style("fill", function(d, i) { return color(i % 20); })
5275

5376
node.append("text")
@@ -67,6 +90,9 @@
6790
+ "S" + p(d[1])[0] + "," + p(d[1])[1]
6891
+ " " + p(d[2])[0] + "," + p(d[2])[1];
6992
})
93+
.style("stroke", function(d) { return color(d[0].index % 20); })
94+
.style("stroke-opacity", function(d) { return 0.3; })
95+
7096

7197
// var mid = svg.selectAll(".node-mid")
7298
// .data(graph.mids)
@@ -100,6 +126,7 @@
100126
data.y = innerRadius
101127
data.x = ((360 / graph2.nodes.length) * i)
102128
data.conns = 0
129+
data.index = i
103130
graph.nodes.push(data)
104131
graph.byName[data.name] = data
105132
})
@@ -122,6 +149,8 @@
122149
graph.paths.push(path)
123150
})
124151

152+
document.getElementById("node-count").innerText = graph.nodes.length
153+
125154
return graph
126155
}
127156

0 commit comments

Comments
 (0)