         setNeedsDisplay()
     }
     
+    func setLastEncodedTimeRange(range: TimeRange) {
+        lastEncodedTimeRange = range
+        setNeedsDisplay()
+    }
+    
     override func drawRect(rect: CGRect) {
+        
+        func drawTimeGrid(ctx: CGContextRef) {
+            let dashArray: [CGFloat] = [2, 2, 2, 2]
+            let seconds = Int(frame.width / CGFloat(secondWidth))
+            CGContextSaveGState(ctx)
+            CGContextSetStrokeColorWithColor(ctx, UIColor.grayColor().CGColor)
+            CGContextSetLineWidth(ctx, 0.5)
+            CGContextSetLineDash(ctx, 3, dashArray, 4)
+            
+            for second in 0...seconds {
+                let x = second * Int(secondWidth)
+                
+                CGContextBeginPath(ctx)
+                CGContextMoveToPoint(ctx, CGFloat(x), 0)
+                CGContextAddLineToPoint(ctx, CGFloat(x), frame.height)
+                CGContextStrokePath(ctx)
+            }
+            
+            CGContextRestoreGState(ctx)
+        }
+        
         func drawLayer(ctx: CGContextRef, sdg: SensorDataGroup, startTime: CFAbsoluteTime) {
             let height = 40.0
             let padding = 4.0
-            let secondWidth = 20.0
             var y: Double = padding
             for (i, sda) in enumerate(sdg.sensorDataArrays) {
                 for (j, sd) in enumerate(sda.sensorDatas) {

                }
                y += height + padding
            }
            
        }
        
        let context = UIGraphicsGetCurrentContext()
        if let sdg = sensorDataGroup {
            if let st = sdg.startTime {
                drawLayer(context, sdg, st)
            }
        }
    }

    }
    
    func mutliDeviceSession(session: MultiDeviceSession, continuousSensorDataEncodedBetween start: CFAbsoluteTime, and end: CFAbsoluteTime) {
        sensorDataGroupView.setLastEncodedTimeRange(TimeRange(start: start, end: end))
    }

}

class SensorDataGroupView : UIView {
    private var sensorDataGroup: SensorDataGroup?
    private var lastEncodedTimeRange: TimeRange?
    private let secondWidth = 20.0
    
    private let colors: [UIColor] = [
        UIColor(red: CGFloat(0.37), green: CGFloat(0.74), blue: CGFloat(0.95), alpha: CGFloat(1.0)),
        UIColor(red: CGFloat(0.33), green: CGFloat(0.44), blue: CGFloat(0.58), alpha: CGFloat(1.0)),
