             let scanner = NSScanner(string: hex)
             var hexValue: CUnsignedLongLong = 0
             if scanner.scanHexLongLong(&hexValue) {
-                switch (countElements(hex)) {
+                switch (count(hex)) {
                 case 3:
                     red   = CGFloat((hexValue & 0xF00) >> 8)       / 15.0
                     green = CGFloat((hexValue & 0x0F0) >> 4)       / 15.0

    var numberFormatter:NSNumberFormatter
    var unit:String?
    
    override init() {
        // Initilaize the default number formatter
        numberFormatter = NSNumberFormatter()
        numberFormatter.minimumIntegerDigits = 1
        numberFormatter.maximumFractionDigits = 1
        
        super.init()
    }
    
    required init(coder aDecoder: NSCoder) {

            CGContextSetFillColorWithColor(context, storageBarValue.color.CGColor)
            CGContextFillRect(context, rectangle)
            
            var titleWidth = count(storageBarValue.title) * Int(titleFontSize/2)
            
            // Title drawing
            if let actualFont = fontTitle {
