(function(e){e.jqplot.DateAxisRenderer=function(){e.jqplot.LinearAxisRenderer.call(this);this.date=new e.jsDate};var n=30.4368499*864E5,p=365.242199*864E5,q=["%M:%S.%#N","%M:%S.%#N","%M:%S.%#N","%M:%S","%M:%S","%M:%S","%M:%S","%H:%M:%S","%H:%M:%S","%H:%M","%H:%M","%H:%M","%H:%M","%H:%M","%H:%M","%a %H:%M","%a %H:%M","%b %e %H:%M","%b %e %H:%M","%b %e %H:%M","%b %e %H:%M","%v","%v","%v","%v","%v","%v","%v"],o=[100,200,500,1E3,2E3,5E3,1E4,15E3,3E4,6E4,12E4,3E5,6E5,9E5,18E5,36E5,72E5,144E5,216E5,288E5,
432E5,864E5,1728E5,2592E5,3456E5,432E6,6048E5,12096E5];e.jqplot.DateAxisRenderer.prototype=new e.jqplot.LinearAxisRenderer;e.jqplot.DateAxisRenderer.prototype.constructor=e.jqplot.DateAxisRenderer;e.jqplot.DateTickFormatter=function(f,h){f||(f="%Y/%m/%d");return e.jsDate.strftime(h,f)};e.jqplot.DateAxisRenderer.prototype.init=function(f){this.tickOptions.formatter=e.jqplot.DateTickFormatter;this.tickInset=0;this.drawBaseline=true;this._daTickInterval=this.daTickInterval=this.baselineColor=this.baselineWidth=
null;e.extend(true,this,f);f=this._dataBounds;for(var h,m,j,g,a,c,d,l=0;l<this._series.length;l++){h={intervals:[],frequencies:{},sortedIntervals:[],min:null,max:null,mean:null};m=0;j=this._series[l];g=j.data;a=j._plotData;c=j._stackData;for(var b=d=0;b<g.length;b++){if(this.name=="xaxis"||this.name=="x2axis"){g[b][0]=(new e.jsDate(g[b][0])).getTime();a[b][0]=(new e.jsDate(g[b][0])).getTime();c[b][0]=(new e.jsDate(g[b][0])).getTime();if(g[b][0]!=null&&g[b][0]<f.min||f.min==null)f.min=g[b][0];if(g[b][0]!=
null&&g[b][0]>f.max||f.max==null)f.max=g[b][0];if(b>0){d=Math.abs(g[b][0]-g[b-1][0]);h.intervals.push(d);if(h.frequencies.hasOwnProperty(d))h.frequencies[d]+=1;else h.frequencies[d]=1}m+=d}else{g[b][1]=(new e.jsDate(g[b][1])).getTime();a[b][1]=(new e.jsDate(g[b][1])).getTime();c[b][1]=(new e.jsDate(g[b][1])).getTime();if(g[b][1]!=null&&g[b][1]<f.min||f.min==null)f.min=g[b][1];if(g[b][1]!=null&&g[b][1]>f.max||f.max==null)f.max=g[b][1];if(b>0){d=Math.abs(g[b][1]-g[b-1][1]);h.intervals.push(d);if(h.frequencies.hasOwnProperty(d))h.frequencies[d]+=
1;else h.frequencies[d]=1}}m+=d}if(j.renderer.bands){if(j.renderer.bands.hiData.length){a=j.renderer.bands.hiData;b=0;for(c=a.length;b<c;b++)if(this.name==="xaxis"||this.name==="x2axis"){a[b][0]=(new e.jsDate(a[b][0])).getTime();if(a[b][0]!=null&&a[b][0]>f.max||f.max==null)f.max=a[b][0]}else{a[b][1]=(new e.jsDate(a[b][1])).getTime();if(a[b][1]!=null&&a[b][1]>f.max||f.max==null)f.max=a[b][1]}}if(j.renderer.bands.lowData.length){a=j.renderer.bands.lowData;b=0;for(c=a.length;b<c;b++)if(this.name==="xaxis"||
this.name==="x2axis"){a[b][0]=(new e.jsDate(a[b][0])).getTime();if(a[b][0]!=null&&a[b][0]<f.min||f.min==null)f.min=a[b][0]}else{a[b][1]=(new e.jsDate(a[b][1])).getTime();if(a[b][1]!=null&&a[b][1]<f.min||f.min==null)f.min=a[b][1]}}}for(var i in h.frequencies)h.sortedIntervals.push({interval:i,frequency:h.frequencies[i]});h.sortedIntervals.sort(function(k,r){return r.frequency-k.frequency});h.min=e.jqplot.arrayMin(h.intervals);h.max=e.jqplot.arrayMax(h.intervals);h.mean=m/g.length;this._intervalStats.push(h);
h=m=j=g=a=c=null}f=null};e.jqplot.DateAxisRenderer.prototype.reset=function(){this.min=this._options.min;this.max=this._options.max;this.tickInterval=this._options.tickInterval;this.numberTicks=this._options.numberTicks;this._autoFormatString="";if(this._overrideFormatString&&this.tickOptions&&this.tickOptions.formatString)this.tickOptions.formatString="";this.daTickInterval=this._daTickInterval};e.jqplot.DateAxisRenderer.prototype.createTicks=function(f){var h=this.ticks,m=this.name,j=this._dataBounds,
g=this.name.charAt(0)==="x"?this._plotDimensions.width:this._plotDimensions.height,a,c,d,l=1,b=null;if(this.tickInterval!=null)if(Number(this.tickInterval))b=[Number(this.tickInterval),"seconds"];else if(typeof this.tickInterval=="string"){c=this.tickInterval.split(" ");if(c.length==1)b=[1,c[0]];else if(c.length==2)b=[c[0],c[1]]}a=this.min!=null?(new e.jsDate(this.min)).getTime():j.min;c=this.max!=null?(new e.jsDate(this.max)).getTime():j.max;if((f=f.plugins.cursor)&&f._zoom&&f._zoom.zooming)this.max=
this.min=null;f=c-a;if(this.tickOptions==null||!this.tickOptions.formatString)this._overrideFormatString=true;if(h.length){for(c=0;c<h.length;c++){d=h[c];a=new this.tickRenderer(this.tickOptions);if(d.constructor==Array){a.value=(new e.jsDate(d[0])).getTime();a.label=d[1]}else a.value=(new e.jsDate(d)).getTime();if(this.showTicks){if(!this.showTickMarks)a.showMark=false}else{a.showLabel=false;a.showMark=false}a.setTick(a.value,this.name);this._ticks.push(a)}this.numberTicks=h.length;this.min=this._ticks[0].value;
this.max=this._ticks[this.numberTicks-1].value;this.daTickInterval=[(this.max-this.min)/(this.numberTicks-1)/1E3,"seconds"]}else if(this.min==null&&this.max==null&&j.min==j.max){d=e.extend(true,{},this.tickOptions,{name:this.name,value:null});this.min=j.min-3E5;this.max=j.max+3E5;this.numberTicks=3;for(c=this.min;c<=this.max;c+=3E5){d.value=c;a=new this.tickRenderer(d);if(this._overrideFormatString&&this._autoFormatString!="")a.formatString=this._autoFormatString;a.showLabel=false;a.showMark=false;
this._ticks.push(a)}if(this.showTicks)this._ticks[1].showLabel=true;if(this.showTickMarks)this._ticks[1].showTickMarks=true}else if(this.min==null&&this.max==null){l=e.extend(true,{},this.tickOptions,{name:this.name,value:null});var i;if(!this.tickInterval&&!this.numberTicks){i=Math.max(g,31);h=115;if(this.tickRenderer===e.jqplot.CanvasAxisTickRenderer&&this.tickOptions.angle)h=115-40*Math.abs(Math.sin(this.tickOptions.angle/180*Math.PI));i=Math.ceil((i-30)/h+1);i=(c-a)/(i-1)}else if(this.tickInterval)i=
(new e.jsDate(0)).add(b[0],b[1]).getTime();else if(this.numberTicks){i=this.numberTicks;i=(c-a)/(i-1)}if(i<=16416E5){var k;h=Number.MAX_VALUE;j=0;for(b=o.length;j<b;j++){g=Math.abs(i-o[j]);if(g<h){h=g;d=o[j];k=q[j]}}k=[d,k];d=k[0];this._autoFormatString=k[1];a=new e.jsDate(a);a=Math.floor((a.getTime()-a.getUtcOffset())/d)*d+a.getUtcOffset();i=Math.ceil((c-a)/d)+1;this.min=a;this.max=a+(i-1)*d;if(this.max<c){this.max+=d;i+=1}this.tickInterval=d;this.numberTicks=i;for(c=0;c<i;c++){l.value=this.min+
c*d;a=new this.tickRenderer(l);if(this._overrideFormatString&&this._autoFormatString!="")a.formatString=this._autoFormatString;if(this.showTicks){if(!this.showTickMarks)a.showMark=false}else{a.showLabel=false;a.showMark=false}this._ticks.push(a)}l=this.tickInterval}else if(i<=9*n){this._autoFormatString="%v";d=Math.round(i/n);if(d<1)d=1;else if(d>6)d=6;k=(new e.jsDate(a)).setDate(1).setHours(0,0,0,0);a=new e.jsDate(c);c=(new e.jsDate(c)).setDate(1).setHours(0,0,0,0);if(a.getTime()!==c.getTime())c=
c.add(1,"month");c=c.diff(k,"month");i=Math.ceil(c/d)+1;this.min=k.getTime();this.max=k.clone().add((i-1)*d,"month").getTime();this.numberTicks=i;for(c=0;c<i;c++){l.value=c===0?k.getTime():k.add(d,"month").getTime();a=new this.tickRenderer(l);if(this._overrideFormatString&&this._autoFormatString!="")a.formatString=this._autoFormatString;if(this.showTicks){if(!this.showTickMarks)a.showMark=false}else{a.showLabel=false;a.showMark=false}this._ticks.push(a)}l=d*n}else{this._autoFormatString="%v";d=Math.round(i/
p);if(d<1)d=1;k=(new e.jsDate(a)).setMonth(0,1).setHours(0,0,0,0);c=(new e.jsDate(c)).add(1,"year").setMonth(0,1).setHours(0,0,0,0);c=c.diff(k,"year");i=Math.ceil(c/d)+1;this.min=k.getTime();this.max=k.clone().add((i-1)*d,"year").getTime();this.numberTicks=i;for(c=0;c<i;c++){l.value=c===0?k.getTime():k.add(d,"year").getTime();a=new this.tickRenderer(l);if(this._overrideFormatString&&this._autoFormatString!="")a.formatString=this._autoFormatString;if(this.showTicks){if(!this.showTickMarks)a.showMark=
false}else{a.showLabel=false;a.showMark=false}this._ticks.push(a)}l=d*p}}else{g=m=="xaxis"||m=="x2axis"?this._plotDimensions.width:this._plotDimensions.height;if(this.min!=null&&this.max!=null&&this.numberTicks!=null)this.tickInterval=null;if(this.tickInterval!=null&&b!=null)this.daTickInterval=b;if(a==c){a-=432E5;c+=432E5}f=c-a;parseInt(Math.max(0,g-100)/100,10);a=this.min!=null?(new e.jsDate(this.min)).getTime():a-f/2*(this.padMin-1);c=this.max!=null?(new e.jsDate(this.max)).getTime():c+f/2*(this.padMax-
1);this.min=a;this.max=c;f=this.max-this.min;if(this.numberTicks==null)if(this.daTickInterval!=null){c=(new e.jsDate(this.max)).diff(this.min,this.daTickInterval[1],true);this.numberTicks=Math.ceil(c/this.daTickInterval[0])+1;this.max=(new e.jsDate(this.min)).add((this.numberTicks-1)*this.daTickInterval[0],this.daTickInterval[1]).getTime()}else this.numberTicks=g>200?parseInt(3+(g-200)/100,10):2;l=f/(this.numberTicks-1)/1E3;if(this.daTickInterval==null)this.daTickInterval=[l,"seconds"];for(c=0;c<
this.numberTicks;c++){a=new e.jsDate(this.min);d=a.add(c*this.daTickInterval[0],this.daTickInterval[1]).getTime();a=new this.tickRenderer(this.tickOptions);if(this.showTicks){if(!this.showTickMarks)a.showMark=false}else{a.showLabel=false;a.showMark=false}a.setTick(d,this.name);this._ticks.push(a)}}if(this.tickInset){this.min-=this.tickInset*l;this.max+=this.tickInset*l}if(this._daTickInterval==null)this._daTickInterval=this.daTickInterval}})(jQuery);
