             //TODO: replace pre-defined colors with array of user-defined colors
             //TODO: and split them proportionally in whole sector
             if colorsArray {
-                switch (rate / 10) {
+                switch (rate / maxValue) {
                 case let r where r >= 0.75:
                     strokeColor = UIColor(hue:
                     112.0 / 360.0, saturation:

            switch (type) {
            case .Left, .Right:
                // For Half gauge you have to fill 50% of circle and round it wisely.
                let percanage = rate / 20 % 0.5
                ringLayer.strokeEnd = (rate >= 10 ? 0.5 : percanage + ((rate != 0 && percanage == 0) ? 0.5 : 0))
            case .Circle, .Custom:
                ringLayer.strokeEnd = rate / 10
            default:
                ringLayer.strokeEnd = rate / 10

            }


        }
    }

    /// This value specify rate value for 100% filled gauge. Default is 10.
    ///i.e. with rate = 10 gauge is 100% filled.
    @IBInspectable public var maxValue: CGFloat = 10 {
        didSet {
            updateLayerProperties()
        }
    }
    /// percantage of filled Gauge. 0..maxValue.
    @IBInspectable public var rate: CGFloat = 8 {
        didSet {
            updateLayerProperties()
        }
