         }
         
         func buttonTapped(sender: UIButton) {
-            let horizontal = sender == self.left ? true : false
+            let horizontal = sender == self.horizontal ? true : false
             controller?.showChart(horizontal: horizontal)
         }
         
         override func didMoveToSuperview() {
-            let views = [self.left, self.right]
+            let views = [self.horizontal, self.vertical]
             for v in views {
                 v.setTranslatesAutoresizingMaskIntoConstraints(false)
             }

            
            self.controller = controller
            
            self.left = UIButton()
            self.left.setTitle("Horizontal", forState: .Normal)
            self.right = UIButton()
            self.right.setTitle("Vertical", forState: .Normal)
            
            self.buttonDirs = [self.left : true, self.right : false]
            
            super.init(frame: frame)
            
            self.addSubview(self.left)
            self.addSubview(self.right)
            
            for button in [self.left, self.right] {
                button.titleLabel?.font = ExamplesDefaults.fontWithSize(14)
                button.setTitleColor(UIColor.blueColor(), forState: .Normal)
                button.addTarget(self, action: "buttonTapped:", forControlEvents: .TouchUpInside)

    
    class DirSelector: UIView {
        
        let horizontal: UIButton
        let vertical: UIButton
        
        weak var controller: StackedBarsExample?
        
