|
2 | 2 | <meta charset="utf-8">
|
3 | 3 | <style>
|
4 | 4 |
|
| 5 | +body { |
| 6 | + font: 11px "Helvetica Neue", Helvetica, Arial, sans-serif; |
| 7 | +} |
| 8 | + |
5 | 9 | .node {
|
6 | 10 | font: 11px "Helvetica Neue", Helvetica, Arial, sans-serif;
|
7 | 11 | }
|
|
12 | 16 | fill: none;
|
13 | 17 | }
|
14 | 18 |
|
| 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 | + |
15 | 33 | </style>
|
16 | 34 | <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 | + |
17 | 40 | <script src="http://d3js.org/d3.v3.min.js"></script>
|
18 | 41 | <script>
|
19 | 42 | var hash = window.location.hash.substring(1)
|
|
47 | 70 | .attr("transform", function(d) { return "rotate(" + (d.x - 90 + rotate) + ")translate(" + d.y + ")"; })
|
48 | 71 |
|
49 | 72 | node.append("svg:circle")
|
50 |
| - .attr("r", function(d) { return 6; }) |
| 73 | + .attr("r", function(d) { return d.conns + 3; }) |
51 | 74 | .style("fill", function(d, i) { return color(i % 20); })
|
52 | 75 |
|
53 | 76 | node.append("text")
|
|
67 | 90 | + "S" + p(d[1])[0] + "," + p(d[1])[1]
|
68 | 91 | + " " + p(d[2])[0] + "," + p(d[2])[1];
|
69 | 92 | })
|
| 93 | + .style("stroke", function(d) { return color(d[0].index % 20); }) |
| 94 | + .style("stroke-opacity", function(d) { return 0.3; }) |
| 95 | + |
70 | 96 |
|
71 | 97 | // var mid = svg.selectAll(".node-mid")
|
72 | 98 | // .data(graph.mids)
|
|
100 | 126 | data.y = innerRadius
|
101 | 127 | data.x = ((360 / graph2.nodes.length) * i)
|
102 | 128 | data.conns = 0
|
| 129 | + data.index = i |
103 | 130 | graph.nodes.push(data)
|
104 | 131 | graph.byName[data.name] = data
|
105 | 132 | })
|
|
122 | 149 | graph.paths.push(path)
|
123 | 150 | })
|
124 | 151 |
|
| 152 | + document.getElementById("node-count").innerText = graph.nodes.length |
| 153 | + |
125 | 154 | return graph
|
126 | 155 | }
|
127 | 156 |
|
|
0 commit comments