     }
     
     func lineGraph(graph: BEMSimpleLineGraphView, valueForPointAtIndex index: Int) -> CGFloat {
-        return xPoints[xPoints.count - 20 + index]
+        if graph == xGraph
+        {
+            return xPoints[xPoints.count - 20 + index]
+        }
+        else if graph == yGraph
+        {
+            return yPoints[yPoints.count - 20 + index]
+        }
+        else
+        {
+            return zPoints[yPoints.count - 20 + index]
+        }
     }
     
     override func viewDidAppear(animated: Bool) {

        
        
        xGraph = BEMSimpleLineGraphView(frame: CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height/3))
        xGraph.animationGraphStyle = BEMLineAnimation.None
        xGraph.enableBezierCurve = true
        xGraph.dataSource = self
        xGraph.delegate = self
        self.view.addSubview(xGraph)
    
    }
    
    func didReceiveOrientationEvent(notification: NSNotification) {
        var orientation = notification.userInfo![kTLMKeyOrientationEvent]! as! TLMOrientationEvent
        
        xPoints.append(CGFloat(orientation.quaternion.x))
        self.refreshGraph(orientation.quaternion)
        
        println("\(orientation.quaternion.x), \(orientation.quaternion.y), \(orientation.quaternion.z), \(orientation.quaternion.w)")

var yPoints : [CGFloat] = [0.0]
var zPoints : [CGFloat] = [0.0]

var temp : [CGFloat] = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]

class ViewController: UIViewController, BEMSimpleLineGraphDataSource, BEMSimpleLineGraphDelegate {

    var xGraph : BEMSimpleLineGraphView!
    var yGraph : BEMSimpleLineGraphView!
    var zGraph : BEMSimpleLineGraphView!
    
    var counter = 1
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        xPoints = temp
        yPoints = temp
        zPoints = temp
        
        TLMHub.sharedHub().attachByIdentifier(myoIdentifier)
        
