 					scope.draw(container, width, height)
 
 				scope.$on 'resize', (event, container, width, height) ->
+					console.log "update"
 					scope.draw(container, width, height)
-					console.log "update"
-					update()
+					#update()
 
 				scope.draw = (container, width, height) ->
 

	($timeout) ->

		data = {}

		return {
			restrict: 'A'

						space = Math.min(@_vspace, @_hspace)
						@_vspace = @_hspace = space

					X = (col) -> (col)*scope._hspace
					Y = (row) -> (row)*scope._vspace

					console.log "rows=", @rows, "cols=", @cols

					# Warning: not for livescript. We want coffescript's array nesting here.
					data = ({x:c, y:r} for r in [0..scope.rows-1] for c in [0..scope.cols-1])

					columns = scope.container.selectAll("g")
					.data(data)

					columns.enter().append("g")

					columns.exit().remove()

					circles = columns.selectAll("circle")
					.data((d)->d)
					.each ->
						d3.select(this)
						.attr("cx", (d)->X(d.x))
						.attr("cy", (d)->Y(d.y))

					circles.enter().append("circle")
						.data((d)->d)
						.attr("r", scope.radius)
						.attr("class", "origin")
						.attr("cx", (d)->X(d.x))
						.attr("cy", (d)->Y(d.y))
					circles .exit().remove()

				attrs.$observe 'along', (val) ->
					scope.along = if val? then ~~val else 10
