jqplot.cursor.min.js 22 KB

1
  1. (function(j){j.jqplot.Cursor=function(r){this.style="crosshair";this.previousCursor="auto";this.show=j.jqplot.config.enablePlugins;this.showTooltip=true;this.followMouse=false;this.tooltipLocation="se";this.tooltipOffset=6;this.showTooltipGridPosition=false;this.showTooltipUnitPosition=true;this.showTooltipDataPosition=false;this.tooltipFormatString="%.4P, %.4P";this.useAxesFormatters=true;this.tooltipAxisGroups=[];this.zoom=false;this.zoomProxy=false;this.zoomTarget=false;this.looseZoom=true;this.clickReset=false;this.dblClickReset=true;this.showVerticalLine=false;this.showHorizontalLine=false;this.constrainZoomTo="none";this.shapeRenderer=new j.jqplot.ShapeRenderer();this._zoom={start:[],end:[],started:false,zooming:false,isZoomed:false,axes:{start:{},end:{}},gridpos:{},datapos:{}};this._tooltipElem;this.zoomCanvas;this.cursorCanvas;this.intersectionThreshold=2;this.showCursorLegend=false;this.cursorLegendFormatString=j.jqplot.Cursor.cursorLegendFormatString;this._oldHandlers={onselectstart:null,ondrag:null,onmousedown:null};this.constrainOutsideZoom=true;this.showTooltipOutsideZoom=false;this.onGrid=false;this._customCursorLegend;this.showCustomCursorLegend=false;this.customCursorLegendFollowMouse=false;this.customCursorLegendFormatString=j.jqplot.Cursor.customCursorLegendFormatString;this.customCursorLegendLocation="se";this.customCursorLegendOffset="6";j.extend(true,this,r)};j.jqplot.Cursor.cursorLegendFormatString="%s x:%s, y:%s";j.jqplot.Cursor.customCursorLegendFormatString="%s:%s %d";j.jqplot.Cursor.init=function(u,t,s){var r=s||{};this.plugins.cursor=new j.jqplot.Cursor(r.cursor);var v=this.plugins.cursor;if(v.show){j.jqplot.eventListenerHooks.push(["jqplotMouseEnter",b]);j.jqplot.eventListenerHooks.push(["jqplotMouseLeave",f]);j.jqplot.eventListenerHooks.push(["jqplotMouseMove",i]);if(v.showCursorLegend){s.legend=s.legend||{};s.legend.renderer=j.jqplot.CursorLegendRenderer;s.legend.formatString=this.plugins.cursor.cursorLegendFormatString;s.legend.show=true}if(v.showCustomCursorLegend){s.legend=s.legend||{};s.legend.renderer=j.jqplot.CursorLegendRenderer;s.legend.formatString=this.plugins.cursor.customCursorLegendFormatString;s.legend.show=true}if(v.zoom){j.jqplot.eventListenerHooks.push(["jqplotMouseDown",a]);if(v.clickReset){j.jqplot.eventListenerHooks.push(["jqplotClick",k])}if(v.dblClickReset){j.jqplot.eventListenerHooks.push(["jqplotDblClick",c])}}this.resetZoom=function(){var y=this.axes;if(!v.zoomProxy){for(var x in y){y[x].reset();y[x]._ticks=[];if(v._zoom.axes[x]!==undefined){y[x]._autoFormatString=v._zoom.axes[x].tickFormatString}}this.redraw()}else{var w=this.plugins.cursor.zoomCanvas._ctx;w.clearRect(0,0,w.canvas.width,w.canvas.height);w=null}this.plugins.cursor._zoom.isZoomed=false;this.target.trigger("jqplotResetZoom",[this,this.plugins.cursor])};if(v.showTooltipDataPosition){v.showTooltipUnitPosition=false;v.showTooltipGridPosition=false;if(r.cursor.tooltipFormatString==undefined){v.tooltipFormatString=j.jqplot.Cursor.cursorLegendFormatString}}}};j.jqplot.Cursor.postDraw=function(){var y=this.plugins.cursor;if(y.zoomCanvas){y.zoomCanvas.resetCanvas();y.zoomCanvas=null}if(y.cursorCanvas){y.cursorCanvas.resetCanvas();y.cursorCanvas=null}if(y._tooltipElem){y._tooltipElem.emptyForce();y._tooltipElem=null}if(y.zoom){y.zoomCanvas=new j.jqplot.GenericCanvas();this.eventCanvas._elem.before(y.zoomCanvas.createElement(this._gridPadding,"jqplot-zoom-canvas",this._plotDimensions,this));y.zoomCanvas.setContext()}var w=document.createElement("div");y._tooltipElem=j(w);w=null;y._tooltipElem.addClass("jqplot-cursor-tooltip");y._tooltipElem.css({position:"absolute",display:"none"});w=j(".jqplot-custom-cursor-legend");y._customCursorLegend=j(w);w=null;y._customCursorLegend.removeAttr("style").css({position:"absolute",display:"none"});if(y.zoomCanvas){y.zoomCanvas._elem.before(y._tooltipElem)}else{this.eventCanvas._elem.before(y._tooltipElem)}if(y.showVerticalLine||y.showHorizontalLine){y.cursorCanvas=new j.jqplot.GenericCanvas();this.eventCanvas._elem.before(y.cursorCanvas.createElement(this._gridPadding,"jqplot-cursor-canvas",this._plotDimensions,this));y.cursorCanvas.setContext()}if(y.showTooltipUnitPosition){if(y.tooltipAxisGroups.length===0){var u=this.series;var v;var r=[];for(var t=0;t<u.length;t++){v=u[t];var x=v.xaxis+","+v.yaxis;if(j.inArray(x,r)==-1){r.push(x)}}for(var t=0;t<r.length;t++){y.tooltipAxisGroups.push(r[t].split(","))}}}};j.jqplot.Cursor.zoomProxy=function(w,s){var r=w.plugins.cursor;var v=s.plugins.cursor;r.zoomTarget=true;r.zoom=true;r.style="auto";r.dblClickReset=false;v.zoom=true;v.zoomProxy=true;s.target.bind("jqplotZoom",u);s.target.bind("jqplotResetZoom",t);function u(y,x,A,z,B){r.doZoom(x,A,w,B)}function t(x,y,z){w.resetZoom()}};j.jqplot.Cursor.prototype.resetZoom=function(v,w){var u=v.axes;var t=w._zoom.axes;if(!v.plugins.cursor.zoomProxy&&w._zoom.isZoomed){for(var s in u){u[s].reset();u[s]._ticks=[];u[s]._autoFormatString=t[s].tickFormatString}v.redraw();w._zoom.isZoomed=false}else{var r=w.zoomCanvas._ctx;r.clearRect(0,0,r.canvas.width,r.canvas.height);r=null}v.target.trigger("jqplotResetZoom",[v,w])};j.jqplot.Cursor.resetZoom=function(r){r.resetZoom()};j.jqplot.Cursor.prototype.doZoom=function(H,u,D,v){var J=v;var G=D.axes;var s=J._zoom.axes;var x=s.start;var t=s.end;var C,F,A,E,w,y,r,I,K;var B=D.plugins.cursor.zoomCanvas._ctx;if((J.constrainZoomTo=="none"&&Math.abs(H.x-J._zoom.start[0])>6&&Math.abs(H.y-J._zoom.start[1])>6)||(J.constrainZoomTo=="x"&&Math.abs(H.x-J._zoom.start[0])>6)||(J.constrainZoomTo=="y"&&Math.abs(H.y-J._zoom.start[1])>6)){if(!D.plugins.cursor.zoomProxy){for(var z in u){if(J._zoom.axes[z]==undefined){J._zoom.axes[z]={};J._zoom.axes[z].numberTicks=G[z].numberTicks;J._zoom.axes[z].tickInterval=G[z].tickInterval;J._zoom.axes[z].daTickInterval=G[z].daTickInterval;J._zoom.axes[z].min=G[z].min;J._zoom.axes[z].max=G[z].max;J._zoom.axes[z].tickFormatString=(G[z].tickOptions!=null)?G[z].tickOptions.formatString:""}if((J.constrainZoomTo=="none")||(J.constrainZoomTo=="x"&&z.charAt(0)=="x")||(J.constrainZoomTo=="y"&&z.charAt(0)=="y")){A=u[z];if(A!=null){if(A>x[z]){w=x[z];y=A}else{E=x[z]-A;w=A;y=x[z]}r=G[z];I=null;if(r.alignTicks){if(r.name==="x2axis"&&D.axes.xaxis.show){I=D.axes.xaxis.numberTicks}else{if(r.name.charAt(0)==="y"&&r.name!=="yaxis"&&r.name!=="yMidAxis"&&D.axes.yaxis.show){I=D.axes.yaxis.numberTicks}}}if(this.looseZoom&&(G[z].renderer.constructor===j.jqplot.LinearAxisRenderer||G[z].renderer.constructor===j.jqplot.LogAxisRenderer)){K=j.jqplot.LinearTickGenerator(w,y,r._scalefact,I);if(G[z].tickInset&&K[0]<G[z].min+G[z].tickInset*G[z].tickInterval){K[0]+=K[4];K[2]-=1}if(G[z].tickInset&&K[1]>G[z].max-G[z].tickInset*G[z].tickInterval){K[1]-=K[4];K[2]-=1}if(G[z].renderer.constructor===j.jqplot.LogAxisRenderer&&K[0]<G[z].min){K[0]+=K[4];K[2]-=1}G[z].min=K[0];G[z].max=K[1];G[z]._autoFormatString=K[3];G[z].numberTicks=K[2];G[z].tickInterval=K[4];G[z].daTickInterval=[K[4]/1000,"seconds"]}else{G[z].min=w;G[z].max=y;G[z].tickInterval=null;G[z].numberTicks=null;G[z].daTickInterval=null}G[z]._ticks=[]}}}B.clearRect(0,0,B.canvas.width,B.canvas.height);D.redraw();J._zoom.isZoomed=true;B=null}D.target.trigger("jqplotZoom",[H,u,D,v])}};j.jqplot.preInitHooks.push(j.jqplot.Cursor.init);j.jqplot.postDrawHooks.push(j.jqplot.Cursor.postDraw);function e(H,t,D){var K=D.plugins.cursor;var x="";var O=false;if(K.showTooltipGridPosition){x=H.x+", "+H.y;O=true}if(K.showTooltipUnitPosition){var G;for(var F=0;F<K.tooltipAxisGroups.length;F++){G=K.tooltipAxisGroups[F];if(O){x+="<br />"}if(K.useAxesFormatters){for(var E=0;E<G.length;E++){if(E){x+=", "}var I=D.axes[G[E]]._ticks[0].formatter;var C=D.axes[G[E]]._ticks[0].formatString;x+=I(C,t[G[E]])}}else{x+=j.jqplot.sprintf(K.tooltipFormatString,t[G[0]],t[G[1]])}O=true}}if(K.showTooltipDataPosition){var v=D.series;var N=d(D,H.x,H.y);var O=false;for(var F=0;F<v.length;F++){if(v[F].show){var z=v[F].index;var u=v[F].label.toString();var J=j.inArray(z,N.indices);var A=undefined;var y=undefined;if(J!=-1){var M=N.data[J].data;if(K.useAxesFormatters){var B=v[F]._xaxis._ticks[0].formatter;var r=v[F]._yaxis._ticks[0].formatter;var L=v[F]._xaxis._ticks[0].formatString;var w=v[F]._yaxis._ticks[0].formatString;A=B(L,M[0]);y=r(w,M[1])}else{A=M[0];y=M[1]}if(O){x+="<br />"}x+=j.jqplot.sprintf(K.tooltipFormatString,u,A,y);O=true}}}}K._tooltipElem.html(x)}function g(K,G){var C=["星期天","星期一","星期二","星期三","星期四","星期五","星期六"];var M=G.plugins.cursor;var E=M.cursorCanvas._ctx;E.clearRect(0,0,E.canvas.width,E.canvas.height);if(M.showVerticalLine){M.shapeRenderer.draw(E,[[K.x,0],[K.x,E.canvas.height]])}if(M.showHorizontalLine){M.shapeRenderer.draw(E,[[0,K.y],[E.canvas.width,K.y]])}var O=d(G,K.x,K.y);if(M.showCursorLegend){var t=j(G.targetId+" td.jqplot-cursor-legend-label");for(var I=0;I<t.length;I++){var z=j(t[I]).data("seriesIndex");var x=G.series[z];var u=x.label.toString();var L=j.inArray(z,O.indices);var B=undefined;var A=undefined;if(L!=-1){var P=O.data[L].data;if(M.useAxesFormatters){var D=x._xaxis._ticks[0].formatter;var r=x._yaxis._ticks[0].formatter;var N=x._xaxis._ticks[0].formatString;var y=x._yaxis._ticks[0].formatString;B=D(N,P[0]);A=r(y,P[1])}else{B=P[0];A=P[1]}}if(G.legend.escapeHtml){j(t[I]).text(j.jqplot.sprintf(M.cursorLegendFormatString,u,B,A))}else{j(t[I]).html(j.jqplot.sprintf(M.cursorLegendFormatString,u,B,A))}}}if(M.showCustomCursorLegend){var t=j(G.targetId+" div.jqplot-custom-cursor-legend-label");var J=false;for(var I=0;I<t.length;I++){var z=j(t[I]).data("seriesIndex");var x=G.series[z];var u=x.label.toString();var L=j.inArray(z,O.indices);var B=undefined;var A=undefined;if(L!=-1){var P=O.data[L].data;if(M.useAxesFormatters){var D=x._xaxis._ticks[0].formatter;var r=x._yaxis._ticks[0].formatter;var H="%F";var F="%w";var y=x._yaxis._ticks[0].formatString;var w=D(H,P[0]);var v=D(F,P[0]);B=w+" "+C[parseInt(v)];A=r(y,P[1])}else{B=P[0];A=P[1]}}var s=j(t[I]).parents(".jqplot-custom-cursor-legend").find(".jqplot-custom-cursor-legend-title");j(s).html(B);if(G.legend.escapeHtml){j(t[I]).text(j.jqplot.sprintf(M.customCursorLegendFormatString,u,undefined,A))}else{j(t[I]).html(j.jqplot.sprintf(M.customCursorLegendFormatString,u,undefined,A))}J=(A==undefined)?true:false}if(!J){M._customCursorLegend.show()}else{M._customCursorLegend.hide()}}E=null}function d(B,G,F){var C={indices:[],data:[]};var H,z,v,D,w,t,u;var A;var E=B.plugins.cursor;for(var z=0;z<B.series.length;z++){H=B.series[z];t=H.renderer;if(H.show){A=E.intersectionThreshold;if(H.showMarker){A+=H.markerRenderer.size/2}for(var w=0;w<H.gridData.length;w++){u=H.gridData[w];if(E.showVerticalLine){if(Math.abs(G-u[0])<=A){C.indices.push(z);C.data.push({seriesIndex:z,pointIndex:w,gridData:u,data:H.data[w]})}}}}}return C}function n(s,u){var w=u.plugins.cursor;var t=w._tooltipElem;switch(w.tooltipLocation){case"nw":var r=s.x+u._gridPadding.left-t.outerWidth(true)-w.tooltipOffset;var v=s.y+u._gridPadding.top-w.tooltipOffset-t.outerHeight(true);break;case"n":var r=s.x+u._gridPadding.left-t.outerWidth(true)/2;var v=s.y+u._gridPadding.top-w.tooltipOffset-t.outerHeight(true);break;case"ne":var r=s.x+u._gridPadding.left+w.tooltipOffset;var v=s.y+u._gridPadding.top-w.tooltipOffset-t.outerHeight(true);break;case"e":var r=s.x+u._gridPadding.left+w.tooltipOffset;var v=s.y+u._gridPadding.top-t.outerHeight(true)/2;break;case"se":var r=s.x+u._gridPadding.left+w.tooltipOffset;var v=s.y+u._gridPadding.top+w.tooltipOffset;break;case"s":var r=s.x+u._gridPadding.left-t.outerWidth(true)/2;var v=s.y+u._gridPadding.top+w.tooltipOffset;break;case"sw":var r=s.x+u._gridPadding.left-t.outerWidth(true)-w.tooltipOffset;var v=s.y+u._gridPadding.top+w.tooltipOffset;break;case"w":var r=s.x+u._gridPadding.left-t.outerWidth(true)-w.tooltipOffset;var v=s.y+u._gridPadding.top-t.outerHeight(true)/2;break;default:var r=s.x+u._gridPadding.left+w.tooltipOffset;var v=s.y+u._gridPadding.top+w.tooltipOffset;break}t.css("left",r);t.css("top",v);t=null}function q(s,u){var w=u.plugins.cursor;var t=w._customCursorLegend;switch(w.customCursorLegendLocation){case"nw":var r=s.x+u._gridPadding.left-t.outerWidth(true)-w.customCursorLegendOffset;var v=s.y+u._gridPadding.top-w.customCursorLegendOffset-t.outerHeight(true);break;case"n":var r=s.x+u._gridPadding.left-t.outerWidth(true)/2;var v=s.y+u._gridPadding.top-w.customCursorLegendOffset-t.outerHeight(true);break;case"ne":var r=s.x+u._gridPadding.left+w.customCursorLegendOffset;var v=s.y+u._gridPadding.top-w.customCursorLegendOffset-t.outerHeight(true);break;case"e":var r=s.x+u._gridPadding.left+w.customCursorLegendOffset;var v=s.y+u._gridPadding.top-t.outerHeight(true)/2;break;case"se":var r=s.x+u._gridPadding.left+w.customCursorLegendOffset;var v=s.y+u._gridPadding.top+w.customCursorLegendOffset;break;case"s":var r=s.x+u._gridPadding.left-t.outerWidth(true)/2;var v=s.y+u._gridPadding.top+w.customCursorLegendOffset;break;case"sw":var r=s.x+u._gridPadding.left-t.outerWidth(true)-w.customCursorLegendOffset;var v=s.y+u._gridPadding.top+w.customCursorLegendOffset;break;case"w":var r=s.x+u._gridPadding.left-t.outerWidth(true)-w.customCursorLegendOffset;var v=s.y+u._gridPadding.top-t.outerHeight(true)/2;break;default:var r=s.x+u._gridPadding.left+w.customCursorLegendOffset;var v=s.y+u._gridPadding.top+w.customCursorLegendOffset;break}t.css("left",r);t.css("top",v);t=null}function m(v){var t=v._gridPadding;var w=v.plugins.cursor;var u=w._tooltipElem;switch(w.tooltipLocation){case"nw":var s=t.left+w.tooltipOffset;var r=t.top+w.tooltipOffset;u.css("left",s);u.css("top",r);break;case"n":var s=(t.left+(v._plotDimensions.width-t.right))/2-u.outerWidth(true)/2;var r=t.top+w.tooltipOffset;u.css("left",s);u.css("top",r);break;case"ne":var s=t.right+w.tooltipOffset;var r=t.top+w.tooltipOffset;u.css({right:s,top:r});break;case"e":var s=t.right+w.tooltipOffset;var r=(t.top+(v._plotDimensions.height-t.bottom))/2-u.outerHeight(true)/2;u.css({right:s,top:r});break;case"se":var s=t.right+w.tooltipOffset;var r=t.bottom+w.tooltipOffset;u.css({right:s,bottom:r});break;case"s":var s=(t.left+(v._plotDimensions.width-t.right))/2-u.outerWidth(true)/2;var r=t.bottom+w.tooltipOffset;u.css({left:s,bottom:r});break;case"sw":var s=t.left+w.tooltipOffset;var r=t.bottom+w.tooltipOffset;u.css({left:s,bottom:r});break;case"w":var s=t.left+w.tooltipOffset;var r=(t.top+(v._plotDimensions.height-t.bottom))/2-u.outerHeight(true)/2;u.css({left:s,top:r});break;default:var s=t.right-w.tooltipOffset;var r=t.bottom+w.tooltipOffset;u.css({right:s,bottom:r});break}u=null}function k(s,r,w,v,u){s.preventDefault();s.stopImmediatePropagation();var x=u.plugins.cursor;if(x.clickReset){x.resetZoom(u,x)}var t=window.getSelection;if(document.selection&&document.selection.empty){document.selection.empty()}else{if(t&&!t().isCollapsed){t().collapse()}}return false}function c(s,r,w,v,u){s.preventDefault();s.stopImmediatePropagation();var x=u.plugins.cursor;if(x.dblClickReset){x.resetZoom(u,x)}var t=window.getSelection;if(document.selection&&document.selection.empty){document.selection.empty()}else{if(t&&!t().isCollapsed){t().collapse()}}return false}function f(x,u,r,A,v){var w=v.plugins.cursor;w.onGrid=false;if(w.show){j(x.target).css("cursor",w.previousCursor);if(w.showTooltip&&!(w._zoom.zooming&&w.showTooltipOutsideZoom&&!w.constrainOutsideZoom)){w._tooltipElem.empty();w._tooltipElem.hide()}if(w.zoom){w._zoom.gridpos=u;w._zoom.datapos=r}if(w.showVerticalLine||w.showHorizontalLine){var C=w.cursorCanvas._ctx;C.clearRect(0,0,C.canvas.width,C.canvas.height);C=null}if(w.showCursorLegend){var B=j(v.targetId+" td.jqplot-cursor-legend-label");for(var t=0;t<B.length;t++){var z=j(B[t]).data("seriesIndex");var s=v.series[z];var y=s.label.toString();if(v.legend.escapeHtml){j(B[t]).text(j.jqplot.sprintf(w.cursorLegendFormatString,y,undefined,undefined))}else{j(B[t]).html(j.jqplot.sprintf(w.cursorLegendFormatString,y,undefined,undefined))}}}if(w.showCustomCursorLegend){w._customCursorLegend.hide()}}}function b(s,r,v,u,t){var w=t.plugins.cursor;w.onGrid=true;if(w.show){w.previousCursor=s.target.style.cursor;s.target.style.cursor=w.style;if(w.showTooltip){e(r,v,t);if(w.followMouse){n(r,t)}else{m(t)}w._tooltipElem.show()}if(w.showCustomCursorLegend){if(w.customCursorLegendFollowMouse){q(r,t)}}if(w.showVerticalLine||w.showHorizontalLine){g(r,t)}}}function i(s,r,v,u,t){var w=t.plugins.cursor;if(w.show){if(w.showTooltip){e(r,v,t);if(w.followMouse){n(r,t)}}if(w.showCustomCursorLegend){if(w.customCursorLegendFollowMouse){q(r,t)}}if(w.showVerticalLine||w.showHorizontalLine){g(r,t)}}}function o(z){var y=z.data.plot;var u=y.eventCanvas._elem.offset();var x={x:z.pageX-u.left,y:z.pageY-u.top};var v={xaxis:null,yaxis:null,x2axis:null,y2axis:null,y3axis:null,y4axis:null,y5axis:null,y6axis:null,y7axis:null,y8axis:null,y9axis:null,yMidAxis:null};var w=["xaxis","yaxis","x2axis","y2axis","y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis","yMidAxis"];var r=y.axes;var s,t;for(s=11;s>0;s--){t=w[s-1];if(r[t].show){v[t]=r[t].series_p2u(x[t.charAt(0)])}}return{offsets:u,gridPos:x,dataPos:v}}function h(A){var y=A.data.plot;var z=y.plugins.cursor;if(z.show&&z.zoom&&z._zoom.started&&!z.zoomTarget){A.preventDefault();var C=z.zoomCanvas._ctx;var w=o(A);var x=w.gridPos;var u=w.dataPos;z._zoom.gridpos=x;z._zoom.datapos=u;z._zoom.zooming=true;var v=x.x;var t=x.y;var B=C.canvas.height;var r=C.canvas.width;if(z.showTooltip&&!z.onGrid&&z.showTooltipOutsideZoom){e(x,u,y);if(z.followMouse){n(x,y)}}if(z.constrainZoomTo=="x"){z._zoom.end=[v,B]}else{if(z.constrainZoomTo=="y"){z._zoom.end=[r,t]}else{z._zoom.end=[v,t]}}var s=window.getSelection;if(document.selection&&document.selection.empty){document.selection.empty()}else{if(s&&!s().isCollapsed){s().collapse()}}l.call(z);C=null}}function a(x,t,s,y,u){var w=u.plugins.cursor;if(u.plugins.mobile){j(document).one("vmouseup.jqplot_cursor",{plot:u},p)}else{j(document).one("mouseup.jqplot_cursor",{plot:u},p)}var v=u.axes;if(document.onselectstart!=undefined){w._oldHandlers.onselectstart=document.onselectstart;document.onselectstart=function(){return false}}if(document.ondrag!=undefined){w._oldHandlers.ondrag=document.ondrag;document.ondrag=function(){return false}}if(document.onmousedown!=undefined){w._oldHandlers.onmousedown=document.onmousedown;document.onmousedown=function(){return false}}if(w.zoom){if(!w.zoomProxy){var z=w.zoomCanvas._ctx;z.clearRect(0,0,z.canvas.width,z.canvas.height);z=null}if(w.constrainZoomTo=="x"){w._zoom.start=[t.x,0]}else{if(w.constrainZoomTo=="y"){w._zoom.start=[0,t.y]}else{w._zoom.start=[t.x,t.y]}}w._zoom.started=true;for(var r in s){w._zoom.axes.start[r]=s[r]}if(u.plugins.mobile){j(document).bind("vmousemove.jqplotCursor",{plot:u},h)}else{j(document).bind("mousemove.jqplotCursor",{plot:u},h)}}}function p(z){var w=z.data.plot;var y=w.plugins.cursor;if(y.zoom&&y._zoom.zooming&&!y.zoomTarget){var v=y._zoom.gridpos.x;var s=y._zoom.gridpos.y;var u=y._zoom.datapos;var A=y.zoomCanvas._ctx.canvas.height;var r=y.zoomCanvas._ctx.canvas.width;var x=w.axes;if(y.constrainOutsideZoom&&!y.onGrid){if(v<0){v=0}else{if(v>r){v=r}}if(s<0){s=0}else{if(s>A){s=A}}for(var t in u){if(u[t]){if(t.charAt(0)=="x"){u[t]=x[t].series_p2u(v)}else{u[t]=x[t].series_p2u(s)}}}}if(y.constrainZoomTo=="x"){s=A}else{if(y.constrainZoomTo=="y"){v=r}}y._zoom.end=[v,s];y._zoom.gridpos={x:v,y:s};y.doZoom(y._zoom.gridpos,u,w,y)}y._zoom.started=false;y._zoom.zooming=false;j(document).unbind("mousemove.jqplotCursor",h);if(document.onselectstart!=undefined&&y._oldHandlers.onselectstart!=null){document.onselectstart=y._oldHandlers.onselectstart;y._oldHandlers.onselectstart=null}if(document.ondrag!=undefined&&y._oldHandlers.ondrag!=null){document.ondrag=y._oldHandlers.ondrag;y._oldHandlers.ondrag=null}if(document.onmousedown!=undefined&&y._oldHandlers.onmousedown!=null){document.onmousedown=y._oldHandlers.onmousedown;y._oldHandlers.onmousedown=null}}function l(){var z=this._zoom.start;var v=this._zoom.end;var u=this.zoomCanvas._ctx;var s,x,y,r;if(v[0]>z[0]){s=z[0];r=v[0]-z[0]}else{s=v[0];r=z[0]-v[0]}if(v[1]>z[1]){x=z[1];y=v[1]-z[1]}else{x=v[1];y=z[1]-v[1]}u.fillStyle="rgba(0,0,0,0.2)";u.strokeStyle="#999999";u.lineWidth=1;u.clearRect(0,0,u.canvas.width,u.canvas.height);u.fillRect(0,0,u.canvas.width,u.canvas.height);u.clearRect(s,x,r,y);u.strokeRect(s,x,r,y);u=null}j.jqplot.CursorLegendRenderer=function(r){j.jqplot.TableLegendRenderer.call(this,r);this.formatString="%s"};j.jqplot.CursorLegendRenderer.prototype=new j.jqplot.TableLegendRenderer();j.jqplot.CursorLegendRenderer.prototype.constructor=j.jqplot.CursorLegendRenderer;j.jqplot.CursorLegendRenderer.prototype.draw=function(v,B){var C=B.plugins.cursor;var E=C.showCustomCursorLegend;if(this._elem){this._elem.emptyForce();this._elem=null}if(this.show){var A=this._series,G;var r=(E)?"jqplot-custom-cursor-legend":"jqplot-cursor-legend";var u=(E)?document.createElement("div"):document.createElement("table");if(E){j("<div class='jqplot-legend jqplot-custom-cursor-legend-title'></div>").appendTo(u)}this._elem=j(u);u=null;this._elem.addClass("jqplot-legend "+r);this._elem.css("position","absolute");var t=false;for(var z=0;z<A.length;z++){G=A[z];if(G.show&&G.showLabel){var y=j.jqplot.sprintf(this.formatString,G.label.toString());if(y){var w=G.color;if(G._stack&&!G.fill){w=""}F.call(this,y,w,t,z,E);t=true}for(var x=0;x<j.jqplot.addLegendRowHooks.length;x++){var D=j.jqplot.addLegendRowHooks[x].call(this,G);if(D){F.call(this,D.label,D.color,t,E);t=true}}}}A=G=null;delete A;delete G}function F(N,J,s,O,M){if(M){var P=j("<div class='jqplot-legend jqplot-custom-cursor-legend-item'></div>").appendTo(this._elem);P.data("seriesIndex",O);j("<div class='jqplot-legend jqplot-custom-cursor-legend-swatch' style='background-color: "+J+";'></div>").appendTo(P);var H=j("<div class='jqplot-legend jqplot-custom-cursor-legend-label'></div>").appendTo(P);H.data("seriesIndex",O);if(this.escapeHtml){H.text(N)}else{H.html(N)}P=null;H=null}else{var K=(s)?this.rowSpacing:"0";var L=j('<tr class="jqplot-legend jqplot-cursor-legend"></tr>').appendTo(this._elem);L.data("seriesIndex",O);j('<td class="jqplot-legend jqplot-cursor-legend-swatch" style="padding-top:'+K+';"><div style="border:1px solid #cccccc;padding:0.2em;"><div class="jqplot-cursor-legend-swatch" style="background-color:'+J+';"></div></div></td>').appendTo(L);var I=j('<td class="jqplot-legend jqplot-cursor-legend-label" style="vertical-align:middle;padding-top:'+K+';"></td>');I.appendTo(L);I.data("seriesIndex",O);if(this.escapeHtml){I.text(N)}else{I.html(N)}L=null;I=null}}return this._elem}})(jQuery);