(function(f){function l(b,c){var g=b.plugins.highlighter,a=b.series[c.seriesIndex],d=a.markerRenderer,h=g.markerRenderer;h.style=d.style;h.lineWidth=d.lineWidth+g.lineWidthAdjust;h.size=d.size+g.sizeAdjust;d=f.jqplot.getColorComponents(d.color);var e=[d[0],d[1],d[2]];h.color="rgba("+e[0]+","+e[1]+","+e[2]+","+(d[3]>=0.6?d[3]*0.6:d[3]*(2-d[3]))+")";h.init();h.draw(a.gridData[c.pointIndex][0],a.gridData[c.pointIndex][1],g.highlightCanvas._ctx)}function m(b,c,g){var a=b.plugins.highlighter,d=a._tooltipElem;
a=f.extend(true,{},a,c.highlighter||{});if(a.useAxesFormatters){var h=c._xaxis._ticks[0].formatter,e=c._yaxis._ticks[0].formatter,j=c._yaxis._ticks[0].formatString;h=h(c._xaxis._ticks[0].formatString,g.data[0]);for(var i=[],k=1;k<a.yvalues+1;k++)i.push(e(j,g.data[k]));if(typeof a.formatString==="string")switch(a.tooltipAxes){case "both":case "xy":i.unshift(h);i.unshift(a.formatString);e=f.jqplot.sprintf.apply(f.jqplot.sprintf,i);break;case "yx":i.push(h);i.unshift(a.formatString);e=f.jqplot.sprintf.apply(f.jqplot.sprintf,
i);break;case "x":e=f.jqplot.sprintf.apply(f.jqplot.sprintf,[a.formatString,h]);break;case "y":i.unshift(a.formatString);e=f.jqplot.sprintf.apply(f.jqplot.sprintf,i);break;default:i.unshift(h);i.unshift(a.formatString);e=f.jqplot.sprintf.apply(f.jqplot.sprintf,i)}else switch(a.tooltipAxes){case "both":case "xy":e=h;for(k=0;k<i.length;k++)e+=a.tooltipSeparator+i[k];break;case "yx":e="";for(k=0;k<i.length;k++)e+=i[k]+a.tooltipSeparator;e+=h;break;case "x":e=h;break;case "y":e=i.join(a.tooltipSeparator);
break;default:e=h;for(k=0;k<i.length;k++)e+=a.tooltipSeparator+i[k]}}else if(typeof a.formatString==="string")e=f.jqplot.sprintf.apply(f.jqplot.sprintf,[a.formatString].concat(g.data));else if(a.tooltipAxes=="both"||a.tooltipAxes=="xy")e=f.jqplot.sprintf(a.tooltipFormatString,g.data[0])+a.tooltipSeparator+f.jqplot.sprintf(a.tooltipFormatString,g.data[1]);else if(a.tooltipAxes=="yx")e=f.jqplot.sprintf(a.tooltipFormatString,g.data[1])+a.tooltipSeparator+f.jqplot.sprintf(a.tooltipFormatString,g.data[0]);
else if(a.tooltipAxes=="x")e=f.jqplot.sprintf(a.tooltipFormatString,g.data[0]);else if(a.tooltipAxes=="y")e=f.jqplot.sprintf(a.tooltipFormatString,g.data[1]);if(f.isFunction(a.tooltipContentEditor))e=a.tooltipContentEditor(e,g.seriesIndex,g.pointIndex,b);d.html(e);e={x:g.gridData[0],y:g.gridData[1]};j=0;if(c.markerRenderer.show==true)j=(c.markerRenderer.size+a.sizeAdjust)/2;h=n;if(c.fillToZero&&c.fill&&g.data[1]<0)h=o;switch(h[p[a.tooltipLocation]]){case "nw":c=e.x+b._gridPadding.left-d.outerWidth(true)-
a.tooltipOffset-0.707*j;b=e.y+b._gridPadding.top-a.tooltipOffset-d.outerHeight(true)-0.707*j;break;case "n":c=e.x+b._gridPadding.left-d.outerWidth(true)/2;b=e.y+b._gridPadding.top-a.tooltipOffset-d.outerHeight(true)-j;break;case "ne":c=e.x+b._gridPadding.left+a.tooltipOffset+0.707*j;b=e.y+b._gridPadding.top-a.tooltipOffset-d.outerHeight(true)-0.707*j;break;case "e":c=e.x+b._gridPadding.left+a.tooltipOffset+j;b=e.y+b._gridPadding.top-d.outerHeight(true)/2;break;case "se":c=e.x+b._gridPadding.left+
a.tooltipOffset+0.707*j;b=e.y+b._gridPadding.top+a.tooltipOffset+0.707*j;break;case "s":c=e.x+b._gridPadding.left-d.outerWidth(true)/2;b=e.y+b._gridPadding.top+a.tooltipOffset+j;break;case "sw":c=e.x+b._gridPadding.left-d.outerWidth(true)-a.tooltipOffset-0.707*j;b=e.y+b._gridPadding.top+a.tooltipOffset+0.707*j;break;case "w":c=e.x+b._gridPadding.left-d.outerWidth(true)-a.tooltipOffset-j;b=e.y+b._gridPadding.top-d.outerHeight(true)/2;break;default:c=e.x+b._gridPadding.left-d.outerWidth(true)-a.tooltipOffset-
0.707*j;b=e.y+b._gridPadding.top-a.tooltipOffset-d.outerHeight(true)-0.707*j}d.css("left",c);d.css("top",b);a.fadeTooltip?d.stop(true,true).fadeIn(a.tooltipFadeSpeed):d.show()}f.jqplot.eventListenerHooks.push(["jqplotMouseMove",function(b,c,g,a,d){c=d.plugins.highlighter;g=d.plugins.cursor;if(c.show)if(a==null&&c.isHighlighting){var h=jQuery.Event("jqplotHighlighterUnhighlight");d.target.trigger(h);b=c.highlightCanvas._ctx;b.clearRect(0,0,b.canvas.width,b.canvas.height);c.fadeTooltip?c._tooltipElem.fadeOut(c.tooltipFadeSpeed):
c._tooltipElem.hide();c.bringSeriesToFront&&d.restorePreviousSeriesOrder();c.isHighlighting=false;c.currentNeighbor=null}else if(a!=null&&d.series[a.seriesIndex].showHighlight&&!c.isHighlighting){h=jQuery.Event("jqplotHighlighterHighlight");h.which=b.which;h.pageX=b.pageX;h.pageY=b.pageY;d.target.trigger(h,[a.seriesIndex,a.pointIndex,a.data,d]);c.isHighlighting=true;c.currentNeighbor=a;c.showMarker&&l(d,a);if(c.showTooltip&&(!g||!g._zoom.started))m(d,d.series[a.seriesIndex],a);c.bringSeriesToFront&&
d.moveSeriesToFront(a.seriesIndex)}else if(a!=null&&c.isHighlighting&&c.currentNeighbor!=a)if(d.series[a.seriesIndex].showHighlight){b=c.highlightCanvas._ctx;b.clearRect(0,0,b.canvas.width,b.canvas.height);c.isHighlighting=true;c.currentNeighbor=a;c.showMarker&&l(d,a);if(c.showTooltip&&(!g||!g._zoom.started))m(d,d.series[a.seriesIndex],a);c.bringSeriesToFront&&d.moveSeriesToFront(a.seriesIndex)}}]);f.jqplot.Highlighter=function(b){this.show=f.jqplot.config.enablePlugins;this.markerRenderer=new f.jqplot.MarkerRenderer({shadow:false});
this.showMarker=true;this.lineWidthAdjust=2.5;this.sizeAdjust=5;this.showTooltip=true;this.tooltipLocation="nw";this.fadeTooltip=true;this.tooltipFadeSpeed="fast";this.tooltipOffset=2;this.tooltipAxes="both";this.tooltipSeparator=", ";this.tooltipContentEditor=null;this.useAxesFormatters=true;this.tooltipFormatString="%.5P";this.formatString=null;this.yvalues=1;this.isHighlighting=this.bringSeriesToFront=false;this.currentNeighbor=null;f.extend(true,this,b)};var n=["nw","n","ne","e","se","s","sw",
"w"],p={nw:0,n:1,ne:2,e:3,se:4,s:5,sw:6,w:7},o=["se","s","sw","w","nw","n","ne","e"];f.jqplot.Highlighter.init=function(b,c,g){this.plugins.highlighter=new f.jqplot.Highlighter((g||{}).highlighter)};f.jqplot.Highlighter.parseOptions=function(){this.showHighlight=true};f.jqplot.Highlighter.postPlotDraw=function(){if(this.plugins.highlighter&&this.plugins.highlighter.highlightCanvas){this.plugins.highlighter.highlightCanvas.resetCanvas();this.plugins.highlighter.highlightCanvas=null}if(this.plugins.highlighter&&
this.plugins.highlighter._tooltipElem){this.plugins.highlighter._tooltipElem.emptyForce();this.plugins.highlighter._tooltipElem=null}this.plugins.highlighter.highlightCanvas=new f.jqplot.GenericCanvas;this.eventCanvas._elem.before(this.plugins.highlighter.highlightCanvas.createElement(this._gridPadding,"jqplot-highlight-canvas",this._plotDimensions,this));this.plugins.highlighter.highlightCanvas.setContext();var b=document.createElement("div");this.plugins.highlighter._tooltipElem=f(b);this.plugins.highlighter._tooltipElem.addClass("jqplot-highlighter-tooltip");
this.plugins.highlighter._tooltipElem.css({position:"absolute",display:"none"});this.eventCanvas._elem.before(this.plugins.highlighter._tooltipElem)};f.jqplot.preInitHooks.push(f.jqplot.Highlighter.init);f.jqplot.preParseSeriesOptionsHooks.push(f.jqplot.Highlighter.parseOptions);f.jqplot.postDrawHooks.push(f.jqplot.Highlighter.postPlotDraw)})(jQuery);
