 
                 millisecondsPerPixel = (scope.duration * 1000) / (width-rightMargin)
                 scope.updatefrequency = Math.max(250, millisecondsPerPixel * 2)
+
+                if scope.updateDataPromise?
+                    # Clear old interval
+                    $interval.cancel(scope.updateDataPromise)
+
+                scope.updateDataPromise = $interval(scope.updateData,scope.updatefrequency)
 
                 scope.x = d3.time.scale().domain([new Date(Date.now() - scope.duration * 1000), new Date()]).range([0, width - rightMargin])
 

            
            scope.data = []
            scope.graphId = Math.floor(Math.random() * 10000000000000001).toString()
            
            scope.setupSize = () ->
                interpolateType = attrs.interpolate || "cardinal"

            ,scope.setupSize,true
            )

            scope.tick = () ->
                scope.now = new Date()
                
                # Set new domain for duration
                scope.x.domain([new Date(Date.now() - scope.duration*1000),new Date()])                

