     
     public var maxZoomY: CGFloat?
     
+    public var zoomPanGestureMode: ChartZoomPanGestureMode = .Max
+    
     public init() {}
+}
+
+public enum ChartZoomPanGestureMode {
+    case OnlyX // Only X axis is zoomed/panned
+    case OnlyY // Only Y axis is zoomed/panned
+    case Max // Only axis corresponding to dimension with max zoom/pan delta is zoomed/panned
+    case Both // Both axes are zoomed/panned
 }
 
 public protocol ChartDelegate {

            let velocityX = sender.velocityInView(sender.view).x
            let velocityY = sender.velocityInView(sender.view).y
            
            func next(index: Int, velocityX: CGFloat, velocityY: CGFloat) {
                dispatch_async(dispatch_get_main_queue()) {
                    

    @objc func onPinch(sender: UIPinchGestureRecognizer) {
        
        guard sender.numberOfTouches() > 1 else {return}
        guard let chartSettings = chart?.settings else {return}
        
        let center = sender.locationInView(self)
        
        let x = abs(sender.locationInView(self).x - sender.locationOfTouch(1, inView: self).x)
        let y = abs(sender.locationInView(self).y - sender.locationOfTouch(1, inView: self).y)
        
        let (deltaX, deltaY): (CGFloat, CGFloat) = {
            switch chartSettings.zoomPanGestureMode {
            case .OnlyX: return (sender.scale, 1)
            case .OnlyY: return (1, sender.scale)
            case .Max: return x > y ? (sender.scale, 1) : (1, sender.scale)
            case .Both:
                // calculate scale x and scale y
                let (absMax, absMin) = x > y ? (abs(x), abs(y)) : (abs(y), abs(x))
                let minScale = (absMin * (sender.scale - 1) / absMax) + 1
                return x > y ? (sender.scale, minScale) : (minScale, sender.scale)
            }
        }()
        
        chart?.zoom(deltaX: deltaX, deltaY: deltaY, centerX: center.x, centerY: center.y, isGesture: true)
        
