phpservermon/static/plugin/jqplot/jqplot.dateAxisRenderer.min.js

4 lines
9.1 KiB
JavaScript
Raw Normal View History

/* jqplot 1.0.9 | (c) 2009-2016 Chris Leonello | jplot.com
jsDate | (c) 2010-2016 Chris Leonello
*/
!function(t){t.jqplot.DateAxisRenderer=function(){t.jqplot.LinearAxisRenderer.call(this),this.date=new t.jsDate};var i=36e5,e=24*i,s=7*e,n=30.4368499*e,a=365.242199*e,r=["%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"],h=[100,200,500,1e3,2e3,5e3,1e4,15e3,3e4,6e4,12e4,3e5,6e5,9e5,18e5,i,2*i,4*i,6*i,8*i,12*i,e,2*e,3*e,4*e,5*e,s,2*s];t.jqplot.DateAxisRenderer.prototype=new t.jqplot.LinearAxisRenderer,t.jqplot.DateAxisRenderer.prototype.constructor=t.jqplot.DateAxisRenderer,t.jqplot.DateTickFormatter=function(i,e){return i||(i="%Y/%m/%d"),t.jsDate.strftime(e,i)},t.jqplot.DateAxisRenderer.prototype.init=function(i){this.tickOptions.formatter=t.jqplot.DateTickFormatter,this.tickInset=0,this.drawBaseline=!0,this.baselineWidth=null,this.baselineColor=null,this.daTickInterval=null,this._daTickInterval=null,t.extend(!0,this,i);for(var e,s,n,a,r,h,l,o=this._dataBounds,m=0;m<this._series.length;m++){e={intervals:[],frequencies:{},sortedIntervals:[],min:null,max:null,mean:null},s=0,a=(n=this._series[m]).data,r=n._plotData,h=n._stackData,l=0;for(var c=0;c<a.length;c++)"xaxis"==this.name||"x2axis"==this.name?(a[c][0]=new t.jsDate(a[c][0]).getTime(),r[c][0]=new t.jsDate(a[c][0]).getTime(),h[c][0]=new t.jsDate(a[c][0]).getTime(),(null!=a[c][0]&&a[c][0]<o.min||null==o.min)&&(o.min=a[c][0]),(null!=a[c][0]&&a[c][0]>o.max||null==o.max)&&(o.max=a[c][0]),c>0&&(l=Math.abs(a[c][0]-a[c-1][0]),e.intervals.push(l),e.frequencies.hasOwnProperty(l)?e.frequencies[l]+=1:e.frequencies[l]=1),s+=l):(a[c][1]=new t.jsDate(a[c][1]).getTime(),r[c][1]=new t.jsDate(a[c][1]).getTime(),h[c][1]=new t.jsDate(a[c][1]).getTime(),(null!=a[c][1]&&a[c][1]<o.min||null==o.min)&&(o.min=a[c][1]),(null!=a[c][1]&&a[c][1]>o.max||null==o.max)&&(o.max=a[c][1]),c>0&&(l=Math.abs(a[c][1]-a[c-1][1]),e.intervals.push(l),e.frequencies.hasOwnProperty(l)?e.frequencies[l]+=1:e.frequencies[l]=1)),s+=l;if(n.renderer.bands){if(n.renderer.bands.hiData.length){c=0;for(var u=(k=n.renderer.bands.hiData).length;c<u;c++)"xaxis"===this.name||"x2axis"===this.name?(k[c][0]=new t.jsDate(k[c][0]).getTime(),(null!=k[c][0]&&k[c][0]>o.max||null==o.max)&&(o.max=k[c][0])):(k[c][1]=new t.jsDate(k[c][1]).getTime(),(null!=k[c][1]&&k[c][1]>o.max||null==o.max)&&(o.max=k[c][1]))}var k;if(n.renderer.bands.lowData.length)for(c=0,u=(k=n.renderer.bands.lowData).length;c<u;c++)"xaxis"===this.name||"x2axis"===this.name?(k[c][0]=new t.jsDate(k[c][0]).getTime(),(null!=k[c][0]&&k[c][0]<o.min||null==o.min)&&(o.min=k[c][0])):(k[c][1]=new t.jsDate(k[c][1]).getTime(),(null!=k[c][1]&&k[c][1]<o.min||null==o.min)&&(o.min=k[c][1]))}for(var d in e.frequencies)e.sortedIntervals.push({interval:d,frequency:e.frequencies[d]});e.sortedIntervals.sort(function(t,i){return i.frequency-t.frequency}),e.min=t.jqplot.arrayMin(e.intervals),e.max=t.jqplot.arrayMax(e.intervals),e.mean=s/a.length,this._intervalStats.push(e),e=s=n=a=r=h=null}o=null},t.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="",this._overrideFormatString&&this.tickOptions&&this.tickOptions.formatString&&(this.tickOptions.formatString=""),this.daTickInterval=this._daTickInterval},t.jqplot.DateAxisRenderer.prototype.createTicks=function(i){this._ticks;var s,l,o=this.ticks,m=this.name,c=this._dataBounds,u=(this._intervalStats,"x"===this.name.charAt(0)?this._plotDimensions.width:this._plotDimensions.height),k=1,d=null;if(null!=this.tickInterval)if(Number(this.tickInterval))d=[Number(this.tickInterval),"seconds"];else if("string"==typeof this.tickInterval){var v=this.tickInterval.split(" ");1==v.length?d=[1,v[0]]:2==v.length&&(d=[v[0],v[1]])}this.tickInterval,z=new t.jsDate(null!=this.min?this.min:c.min).getTime(),s=new t.jsDate(null!=this.max?this.max:c.max).getTime();var T=i.plugins.cursor;T&&T._zoom&&T._zoom.zo