(function(e){e.jqplot.PointLabels=function(a){this.show=e.jqplot.config.enablePlugins;this.location="n";this.labelsFromSeries=false;this.seriesLabelIndex=null;this.labels=[];this._labels=[];this.stackedValue=false;this.xpadding=this.ypadding=6;this.escapeHTML=true;this.edgeTolerance=-5;this.formatter=e.jqplot.DefaultTickFormatter;this.formatString="";this.hideZeros=false;this._elems=[];e.extend(true,this,a)};var m={nw:0,n:1,ne:2,e:3,se:4,s:5,sw:6,w:7},n=["se","s","sw","w","nw","n","ne","e"];e.jqplot.PointLabels.init=
function(a,b,c,d){a=e.extend(true,{},c,d);a.pointLabels=a.pointLabels||{};if(this.renderer.constructor===e.jqplot.BarRenderer&&this.barDirection==="horizontal"&&!a.pointLabels.location)a.pointLabels.location="e";this.plugins.pointLabels=new e.jqplot.PointLabels(a.pointLabels);this.plugins.pointLabels.setLabels.call(this)};e.jqplot.PointLabels.prototype.setLabels=function(){var a=this.plugins.pointLabels,b;b=a.seriesLabelIndex!=null?a.seriesLabelIndex:this.renderer.constructor===e.jqplot.BarRenderer&&
this.barDirection==="horizontal"?0:this._plotData.length===0?0:this._plotData[0].length-1;a._labels=[];if(a.labels.length===0||a.labelsFromSeries)if(a.stackedValue){if(this._plotData.length&&this._plotData[0].length)for(var c=0;c<this._plotData.length;c++)a._labels.push(this._plotData[c][b])}else{var d=this.data;if(this.renderer.constructor===e.jqplot.BarRenderer&&this.waterfall)d=this._data;if(d.length&&d[0].length)for(c=0;c<d.length;c++)a._labels.push(d[c][b])}else if(a.labels.length)a._labels=
a.labels};e.jqplot.PointLabels.prototype.xOffset=function(a,b){b=b||this.location;var c;switch(b){case "nw":c=-a.outerWidth(true)-this.xpadding;break;case "n":c=-a.outerWidth(true)/2;break;case "ne":c=this.xpadding;break;case "e":c=this.xpadding;break;case "se":c=this.xpadding;break;case "s":c=-a.outerWidth(true)/2;break;case "sw":c=-a.outerWidth(true)-this.xpadding;break;case "w":c=-a.outerWidth(true)-this.xpadding;break;default:c=-a.outerWidth(true)-this.xpadding}return c};e.jqplot.PointLabels.prototype.yOffset=
function(a,b){b=b||this.location;var c;switch(b){case "nw":c=-a.outerHeight(true)-this.ypadding;break;case "n":c=-a.outerHeight(true)-this.ypadding;break;case "ne":c=-a.outerHeight(true)-this.ypadding;break;case "e":c=-a.outerHeight(true)/2;break;case "se":c=this.ypadding;break;case "s":c=this.ypadding;break;case "sw":c=this.ypadding;break;case "w":c=-a.outerHeight(true)/2;break;default:c=-a.outerHeight(true)-this.ypadding}return c};e.jqplot.PointLabels.draw=function(a,b,c){b=this.plugins.pointLabels;
b.setLabels.call(this);for(var d=0;d<b._elems.length;d++)b._elems[d].emptyForce();b._elems.splice(0,b._elems.length);if(b.show){d="_"+this._stackAxis+"axis";if(!b.formatString){b.formatString=this[d]._ticks[0].formatString;b.formatter=this[d]._ticks[0].formatter}var i=this._plotData,o=this._xaxis,p=this._yaxis,f;d=0;for(var q=b._labels.length;d<q;d++){var g=b._labels[d];if(b.hideZeros&&parseInt(b._labels[d],10)==0)g="";if(g!=null)g=b.formatter(b.formatString,g);f=document.createElement("div");b._elems[d]=
e(f);f=b._elems[d];f.addClass("jqplot-point-label jqplot-series-"+this.index+" jqplot-point-"+d);f.css("position","absolute");f.insertAfter(a.canvas);b.escapeHTML?f.text(g):f.html(g);var h=b.location;if(this.fillToZero&&i[d][1]<0||this.fillToZero&&this._type==="bar"&&this.barDirection==="horizontal"&&i[d][0]<0||(this.waterfall&&parseInt(g,10))<0)h=n[m[h]];g=o.u2p(i[d][0])+b.xOffset(f,h);h=p.u2p(i[d][1])+b.yOffset(f,h);if(this._stack&&!b.stackedValue)if(this.barDirection==="vertical")h=(this._barPoints[d][0][1]+
this._barPoints[d][1][1])/2+c._gridPadding.top-0.5*f.outerHeight(true);else g=(this._barPoints[d][2][0]+this._barPoints[d][0][0])/2+c._gridPadding.left-0.5*f.outerWidth(true);if(this.renderer.constructor==e.jqplot.BarRenderer)if(this.barDirection=="vertical")g+=this._barNudge;else h-=this._barNudge;f.css("left",g);f.css("top",h);var r=g+f.width(),s=h+f.height(),j=b.edgeTolerance,k=e(a.canvas).position().left,l=e(a.canvas).position().top,t=a.canvas.width+k,u=a.canvas.height+l;if(g-j<k||h-j<l||r+j>
t||s+j>u)f.remove()}}};e.jqplot.postSeriesInitHooks.push(e.jqplot.PointLabels.init);e.jqplot.postDrawSeriesHooks.push(e.jqplot.PointLabels.draw)})(jQuery);
