         
         currentLinePath.removeAllPoints()
         
-        let numberOfPoints = min(data.count, activePointsInterval.endIndex)
-        
         let pathSegmentAdder = lineStyle == .Straight ? addStraightLineSegment : addCurvedLineSegment
         
         zeroYPosition = calculatePosition(0, value: self.range.min).y

        }
        
        // Connect each point on the graph with a segment.
        for i in activePointsInterval.startIndex ..< numberOfPoints {
            
            let startPoint = graphPoints[i].location
            let endPoint = graphPoints[i+1].location

        let actualMin = clamp(min - numberOfPointsOffscreen, min: minPossible, max: maxPossible)
        let actualMax = clamp(max + numberOfPointsOffscreen, min: minPossible, max: maxPossible)
        
        return actualMin ... actualMax
    }
    
    private func calculateRangeForActivePointsInterval(interval: Range<Int>) -> (min: Double, max: Double) {
        
        let dataForActivePoints = data[interval]
        
        // We don't have any active points, return defaults.
        if(dataForActivePoints.count == 0) {
