!function(a){function b(e){var j,k=this,l=e.data||{};if(l.elem)k=e.dragTarget=l.elem,e.dragProxy=i.proxy||k,e.cursorOffsetX=l.pageX-l.left,e.cursorOffsetY=l.pageY-l.top,e.offsetX=e.pageX-e.cursorOffsetX,e.offsetY=e.pageY-e.cursorOffsetY;else if(i.dragging||l.which>0&&e.which!=l.which||a(e.target).is(l.not))return;switch(e.type){case"mousedown":return a.extend(l,a(k).offset(),{"elem":k,"target":e.target,"pageX":e.pageX,"pageY":e.pageY}),g.add(document,"mousemove mouseup",b,l),f(k,!1),i.dragging=null,!1;case!i.dragging&&"mousemove":if(d(e.pageX-l.pageX)+d(e.pageY-l.pageY)b),!1}function e(a){if(1!=a.which)return!1;var c=b.getPlaceholder().css("cursor");c&&(j=c),b.getPlaceholder().css("cursor",b.getOptions().pan.cursor),k=a.pageX,l=a.pageY}function f(a){var c=b.getOptions().pan.frameRate;!m&&c&&(m=setTimeout(function(){b.pan({"left":k-a.pageX,"top":l-a.pageY}),k=a.pageX,l=a.pageY,m=null},1/c*1e3))}function g(a){m&&(clearTimeout(m),m=null),b.getPlaceholder().css("cursor",j),b.pan({"left":k-a.pageX,"top":l-a.pageY})}function h(a,b){var h=a.getOptions();h.zoom.interactive&&(b[h.zoom.trigger](c),b.mousewheel(d)),h.pan.interactive&&(b.bind("dragstart",{"distance":10},e),b.bind("drag",f),b.bind("dragend",g))}function i(a,b){b.unbind(a.getOptions().zoom.trigger,c),b.unbind("mousewheel",d),b.unbind("dragstart",e),b.unbind("drag",f),b.unbind("dragend",g),m&&clearTimeout(m)}var j="default",k=0,l=0,m=null;b.zoomOut=function(a){a||(a={}),a.amount||(a.amount=b.getOptions().zoom.amount),a.amount=1/a.amount,b.zoom(a)},b.zoom=function(c){c||(c={});var d=c.center,e=c.amount||b.getOptions().zoom.amount,f=b.width(),g=b.height();d||(d={"left":f/2,"top":g/2});var h=d.left/f,i=d.top/g,j={"x":{"min":d.left-h*f/e,"max":d.left+(1-h)*f/e},"y":{"min":d.top-i*g/e,"max":d.top+(1-i)*g/e}};a.each(b.getAxes(),function(a,b){var c=b.options,d=j[b.direction].min,f=j[b.direction].max,g=c.zoomRange,h=c.panRange;if(g!==!1){if(d=b.c2p(d),f=b.c2p(f),d>f){var i=d;d=f,f=i}h&&(null!=h[0]&&dh[1]&&(f=h[1]));var k=f-d;g&&(null!=g[0]&&k1||null!=g[1]&&k>g[1]&&1>e)||(c.min=d,c.max=f)}}),b.setupGrid(),b.draw(),c.preventEvent||b.getPlaceholder().trigger("plotzoom",[b,c])},b.pan=function(c){var d={"x":+c.left,"y":+c.top};isNaN(d.x)&&(d.x=0),isNaN(d.y)&&(d.y=0),a.each(b.getAxes(),function(a,b){var c,e,f=b.options,g=d[b.direction];c=b.c2p(b.p2c(b.min)+g),e=b.c2p(b.p2c(b.max)+g);var h=f.panRange;h!==!1&&(h&&(null!=h[0]&&h[0]>c&&(g=h[0]-c,c+=g,e+=g),null!=h[1]&&h[1]