 
 class ISTimeline: UIView {
 
-    let diameter:CGFloat = 10.0
+    let diameter:CGFloat = 6.0
     let lineWidth:CGFloat = 2.0
-    let lineColor = UIColor.whiteColor()
-    let points = ["start", "point", "end"]
+    let lineColor = UIColor.lightGrayColor()
+    
+    let bubbleColor = UIColor.lightGrayColor()
+    let bubbleRadius:CGFloat = 2.0
+    let textColor = UIColor.whiteColor()
+    
+    var points = ["start", "point", "end"]
+    
+    let margin:CGFloat = 30
     
     override func drawRect(rect: CGRect) {
         let ctx: CGContextRef = UIGraphicsGetCurrentContext()!

                drawLine(start, end: end, color: lineColor)
            }
            drawPoint(arr[i], color: UIColor.clearColor())
        }
        
        CGContextClosePath(ctx)

        
        let shapeLayer = CAShapeLayer()
        shapeLayer.path = path.CGPath
        shapeLayer.strokeColor = lineColor.CGColor
        shapeLayer.fillColor = color.CGColor
        shapeLayer.lineWidth = lineWidth
        
        self.layer.addSublayer(shapeLayer)
    }
    
    private func drawBubble(point:CGPoint, color:UIColor, text:String) {
        var cPoint = point
        cPoint.x += diameter + 5
        cPoint.y -= 12
        
        let label = UILabel()
        label.text = text
        label.textColor = textColor
        label.font = UIFont.boldSystemFontOfSize(12.0)
        
        let rect = CGRectMake(cPoint.x + 8, cPoint.y, label.intrinsicContentSize().width + margin - 10, 30)
        let path = UIBezierPath(roundedRect: rect, cornerRadius: bubbleRadius)
        
        let rectLayer = CAShapeLayer()
        rectLayer.path = path.CGPath
        rectLayer.fillColor = color.CGColor
        
        self.layer.addSublayer(rectLayer)
        
        let triangle = UIBezierPath()
        let initialPoint = CGPointMake(cPoint.x + 8, cPoint.y + rect.height / 2 - 8)
        triangle.moveToPoint(initialPoint)
        triangle.addLineToPoint(initialPoint)
        triangle.addLineToPoint(CGPointMake(cPoint.x, cPoint.y + rect.height / 2))
        triangle.addLineToPoint(CGPointMake(cPoint.x + 8, cPoint.y + rect.height / 2 + 8))
        
        let triangleLayer = CAShapeLayer()
        triangleLayer.path = triangle.CGPath
        triangleLayer.fillColor = color.CGColor
        
        self.layer.addSublayer(triangleLayer)
        
        let labelRect = CGRectMake(rect.origin.x + 10, rect.origin.y + 1, rect.size.width - 10, rect.size.height - 1)
        label.frame = labelRect
        self.addSubview(label)
    }
}
