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