 	svg = d3.select(@).append('svg')
 		.attr('width', diameter)
 		.attr('height', diameter)
-		.attr('class', 'bubble');
-	
-	# Get the dependency counts
-	d3.json 'dependency-counts.json', (error, data) ->
-		dependencyCounts = data
-		renderDependencyCountsGraph data
+		.attr('class', 'bubble')
 	
 	# Render the graph
 	renderDependencyCountsGraph = (data) ->

# d3 dependency count graph
###

dependencyCounts = {}
renderDependencyCountsGraph = null

$('#dependency-counts-graph').each ->

				renderDependencyCountsGraph data
		)
	
	lastQ = null
	
	searchField.keyup ->
		
		q = searchField.val()
		
		if q isnt lastQ
			
			clearTimeout searchTimeoutId
			
			if q.length is 0
				
				renderDependencyCountsGraph(dependencyCounts)
				
			else if q.length > 2
				
				searchTimeoutId = setTimeout(
					-> search q
					1000
				)
			
			lastQ = q
	
	# Get the dependency counts
	d3.json 'dependency-counts.json', (error, data) ->
		dependencyCounts = data
		
		if searchField.val()
			search searchField.val() 
		else
			renderDependencyCountsGraph data