             }
             else
             {
-                _rangePoints[0].x = CGFloat(e.xIndex)
-                _rangePoints[0].y = CGFloat(e.high) * phaseY
-                _rangePoints[1].x = CGFloat(e.xIndex)
-                _rangePoints[1].y = CGFloat(e.low) * phaseY
-
-                _openPoints[0].x = CGFloat(e.xIndex) - 0.5 + barSpace
-                _openPoints[0].y = CGFloat(e.open) * phaseY
-                _openPoints[1].x = CGFloat(e.xIndex)
-                _openPoints[1].y = CGFloat(e.open) * phaseY
-
-                _closePoints[0].x = CGFloat(e.xIndex) + 0.5 - barSpace
-                _closePoints[0].y = CGFloat(e.close) * phaseY
-                _closePoints[1].x = CGFloat(e.xIndex)
-                _closePoints[1].y = CGFloat(e.close) * phaseY
+                _rangePoints[0].x = CGFloat(xIndex)
+                _rangePoints[0].y = CGFloat(high) * phaseY
+                _rangePoints[1].x = CGFloat(xIndex)
+                _rangePoints[1].y = CGFloat(low) * phaseY
+
+                _openPoints[0].x = CGFloat(xIndex) - 0.5 + barSpace
+                _openPoints[0].y = CGFloat(open) * phaseY
+                _openPoints[1].x = CGFloat(xIndex)
+                _openPoints[1].y = CGFloat(open) * phaseY
+
+                _closePoints[0].x = CGFloat(xIndex) + 0.5 - barSpace
+                _closePoints[0].y = CGFloat(close) * phaseY
+                _closePoints[1].x = CGFloat(xIndex)
+                _closePoints[1].y = CGFloat(close) * phaseY
                 
                 trans.pointValuesToPixel(&_rangePoints)
                 trans.pointValuesToPixel(&_openPoints)

                        CGContextStrokeRect(context, _bodyRect)
                    }
                }
                else if (e.open < e.close)
                {
                    let color = dataSet.increasingColor ?? dataSet.colorAt(j)
                    

                var shadowColor: UIColor! = nil
                if (dataSet.shadowColorSameAsCandle)
                {
                    if (open > close)
                    {
                        shadowColor = dataSet.decreasingColor ?? dataSet.colorAt(j)
                    }
                    else if (open < close)
                    {
                        shadowColor = dataSet.increasingColor ?? dataSet.colorAt(j)
                    }
