         return range
     }
 
-    class func globalYRange(trendsAlgorithmModel: TrendsAlgorithmModel?, trend: Trend) -> CPTPlotRange {
-        //let rangeEmpty = CPTPlotRange(location: 0.0, length: 0.0)
-
-        var xAxisLabelHeight: Double
-        var rangeMaximum: Double
-
+    class func globalYRange(trend: Trend) -> CPTPlotRange {
+        let length = NSNumber(value:TrendViewController.rangeMaximum(trend: trend)
+            + TrendViewController.xAxisLabelHeight(trend: trend))
+        let range = CPTPlotRange(location: NSNumber(value: -xAxisLabelHeight(trend: trend)),
+                                 length: length)
+        return range
+    }
+    
+    class func xAxisLabelHeight(trend: Trend) -> Double {
         switch trend {
         case .bg:
-            xAxisLabelHeight = 5
-            rangeMaximum = 120
-        case .ha1c:
-            xAxisLabelHeight = 0.5
-            rangeMaximum = 11
-        }
-
-        let range = CPTPlotRange(location: NSNumber(value: -xAxisLabelHeight),
-                                 length: NSNumber(value:rangeMaximum + xAxisLabelHeight))
-        return range
+            return 5.0
+        case .ha1c:
+            return 0.5
+        }
+    }
+
+    class func rangeMaximum(trend: Trend) -> Double {
+        switch trend {
+        case .bg:
+            return 120.0
+        case .ha1c:
+            return 11.0
+        }
     }
 
     func configureAxes(graph: CPTXYGraph) {

        if coordinate == CPTCoordinate.X {
            axisSet.yAxis?.orthogonalPosition = NSNumber(value:(range.location.doubleValue + TrendViewController.yAxisLabelWidth))
            //axisSet.xAxis?.titleLocation = CPTDecimalFromDouble(range.locationDouble + (range.lengthDouble / 2.0)) as NSNumber?
        } else {
            axisSet.xAxis?.orthogonalPosition = range.location
            //axisSet.yAxis?.titleLocation = CPTDecimalFromDouble(range.locationDouble + (range.lengthDouble / 2.0)) as NSNumber?
        }
        return range

        plotSpace.xRange = TrendViewController.xRange(trendsAlgorithmModel: trendsAlgorithmModel,
                                                      trend: trend)

        plotSpace.globalYRange = TrendViewController.globalYRange(trend: trend)
        plotSpace.yRange = plotSpace.globalYRange!
    }

