 
 .controller('widgetCtrl', [
   '$scope'
-  '$interval'
   'widgetFactory'
   'robot'
 
-($scope, $interval, widgetFactory, robot) ->
+($scope, widgetFactory, robot) ->
   $scope.widgets = []
   $scope.mostRecentWidget = {}
 

    $(jQelm).draggable({
      containment: 'parent'
      start: (event, ui) ->
        widget.render = false
        for series in widget.data
          series.values = series.values.slice()
      stop: (event, ui) ->
        widget.position = ui.position
        widget.render = true
      })
)



  $scope.addWidget = (peripheralFilter = {id: -1}) ->
    $scope.widgets.push new widgetFactory(robot.peripheral(peripheralFilter), 'linechart')
    $scope.widgets[$scope.widgets.length-1].update()

  $scope.removeWidget = (widget) ->
    id = widget.id
