Commit 76583113 authored by S Anand's avatar S Anand

TST: add test for network collision

parent 46ce3feb
......@@ -40,17 +40,21 @@ d3.csv('trains.csv', function(data) {
.key('from', function(d) { return d.from_station_name })
.val('distance', d3.sum, 'distance')
var radius = function(node) { return Math.max(4, Math.min(20, Math.pow(node.distance, .5))) }
var force = G.network.force()
.data(network)
.circle(function(nodes) {
nodes
.attr('r', function(node) { return Math.max(4, Math.min(20, Math.pow(node.distance, .5))) })
.attr('r', radius)
.attr('fill', function(node) { return node.key == 'type' ? 'rgba(255,128,128,.5)' : 'rgba(128,128,128,.5)' })
.append('title')
.text(function(node) { return node.key + ': ' + node.value })
})
.collide(G.network.collide.circle(radius, 0))
.draw('svg')
force.force.gravity(0.4)
force.brush.on('brush', function() {
var selected = network.nodes.filter(function(d) { return d.selected })
d3.selectAll('ul li').remove()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment