                     
                     // Set the color for the currently drawn value. If the index is out of bounds, reuse colors.
                     CGContextSetFillColorWithColor(context, dataSet.colorAt(k).CGColor)
-                    CGContextFillRect(context, barRect)
+
+                    if let (raundingCorners, cornerRadii) = self.calcRectCorners(y) {
+                        let path: UIBezierPath = UIBezierPath(roundedRect: barRect,
+                            byRoundingCorners: raundingCorners,
+                            cornerRadii: cornerRadii)
+                        path.fill()
+                    }
+                    else {
+                        CGContextFillRect(context, barRect)
+                    }
                 }
             }
         }

                    posOffset = -posOffset - valueTextHeight
                    negOffset = -negOffset - valueTextHeight
                }
                
                var valueTextColor = dataSet.valueTextColor
                
                var formatter = dataSet.valueFormatter

                
                // Set the color for the currently drawn value. If the index is out of bounds, reuse colors.
                CGContextSetFillColorWithColor(context, dataSet.colorAt(j).CGColor)

                if let (raundingCorners, cornerRadii) = self.calcRectCorners(y) {
                    let path: UIBezierPath = UIBezierPath(roundedRect: barRect,
                        byRoundingCorners: raundingCorners,
                        cornerRadii: cornerRadii)
                    path.fill()
                }
                else {
                    CGContextFillRect(context, barRect)
                }
            }
            else
            {
