 
   $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


.controller('widgetCtrl', [
  '$scope'
  '$interval'
  'widgetFactory'
  'robot'

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


    jQelm = $(elm[0])
    $(jQelm).resizable({
      start: (event, ui) ->
        for series in widget.data
          series.values = series.values.slice()
      stop: (event, ui) ->
        widget.update()
    })
)

