highcharts panning

Boos picture Boos · Apr 20, 2012 · Viewed 7.9k times · Source

I'm trying to implement highcharts panning based on this example: http://jsfiddle.net/HXUmK/5/

But I want to be able to zoom with the left mouse button and pan with the right mouse button. So I modified the code above and managed to make it work a little, but when I pan holding the right mouse button, the charts also zoomes.

Is there a way I can disable right mouse button zooming in highcharts?

Edit: Sorry for not being very clear about it. The code in the jsfiddle is not my code. Forget that code, it's just an example form witch I started. I am trying to modify that code in order to get left button zoom and right button pan. So I disabled the mousewheel zoom and activated the standars highcharts zoom

Edit2: Here is my code: http://jsfiddle.net/TKPQN/

Answer

Luca picture Luca · Mar 14, 2013

You can try with selection event:

chart: {
        ...
        events:{
            selection: function(event) {
                if (lastButton == 1)
                    event.preventDefault();
            }
       }
    }

See http://jsfiddle.net/TKPQN/48/