/** * Copyright (c) 2009 Chris Leonello * jqPlot is currently available for use in all personal or commercial projects * under both the MIT and GPL version 2.0 licenses. This means that you can * choose the license that best suits your project and use it accordingly. * * Although not required, the author would appreciate an email letting him * know of any substantial use of jqPlot. You can reach the author at: * chris dot leonello at gmail dot com or see http://www.jqplot.com/info.php . * * If you are feeling kind and generous, consider supporting the project by * making a donation at: http://www.jqplot.com/donate.php . */ (function(d){d.jqplot.DateAxisRenderer=function(){d.jqplot.LinearAxisRenderer.call(this)};d.jqplot.DateAxisRenderer.prototype=new d.jqplot.LinearAxisRenderer();d.jqplot.DateAxisRenderer.prototype.constructor=d.jqplot.DateAxisRenderer;d.jqplot.DateTickFormatter=function(j,k){if(!j){j="%Y/%m/%d"}return Date.create(k).strftime(j)};d.jqplot.DateAxisRenderer.prototype.init=function(n){this.tickOptions.formatter=d.jqplot.DateTickFormatter;this.daTickInterval=null;this._daTickInterval=null;d.extend(true,this,n);var l=this._dataBounds;for(var o=0;ol.max||l.max==null){l.max=r[m][0]}}else{r[m][1]=Date.create(r[m][1]).getTime();k[m][1]=Date.create(r[m][1]).getTime();q[m][1]=Date.create(r[m][1]).getTime();if(r[m][1]l.max||l.max==null){l.max=r[m][1]}}}}};d.jqplot.DateAxisRenderer.prototype.reset=function(){this.min=this._min;this.max=this._max;this.tickInterval=this._tickInterval;this.numberTicks=this._numberTicks;this.daTickInterval=this._daTickInterval};d.jqplot.DateAxisRenderer.prototype.createTicks=function(){var C=this._ticks;var z=this.ticks;var D=this.name;var B=this._dataBounds;var w,A;var u,x;var l,k;var j,y;if(z.length){for(y=0;y200){this.numberTicks=parseInt(3+(w-200)/100,10)}else{this.numberTicks=2}}}if(this.daTickInterval==null){this.daTickInterval=[q/(this.numberTicks-1)/1000,"seconds"]}for(var y=0;y0?"floor":"ceil"](j/12));var k=l.getMonth()+(j%12);if(k==12){k=0;l.setYear(l.getFullYear()+1)}else{if(k==-1){k=11;l.setYear(l.getFullYear()-1)}}l.setMonth(k)},diff:function(n,l){var j=n.getFullYear()-l.getFullYear();var k=n.getMonth()-l.getMonth()+(j*12);var m=n.getDate()-l.getDate();return k+(m/30)}},year:{add:function(k,j){k.setYear(k.getFullYear()+Math[j>0?"floor":"ceil"](j))},diff:function(k,j){return c.month.diff(k,j)/12}}};for(var i in c){if(i.substring(i.length-1)!="s"){c[i+"s"]=c[i]}}var h=function(m,l){if(Date.prototype.strftime.formatShortcuts[l]){return m.strftime(Date.prototype.strftime.formatShortcuts[l])}else{var j=(Date.prototype.strftime.formatCodes[l]||"").split(".");var k=m["get"+j[0]]?m["get"+j[0]]():"";if(j[1]){k=e(k,j[1])}return k}};var f={succ:function(j){return this.clone().add(1,j)},add:function(l,k){var j=c[k]||c.day;if(typeof j=="number"){this.setTime(this.getTime()+(j*l))}else{j.add(this,l)}return this},diff:function(k,n,j){k=Date.create(k);if(k===null){return null}var l=c[n]||c.day;if(typeof l=="number"){var m=(this.getTime()-k.getTime())/l}else{var m=l.diff(this,k)}return(j?m:Math[m>0?"floor":"ceil"](m))},strftime:function(k){var m=k||"%Y-%m-%d",j="",l;while(m.length>0){if(l=m.match(Date.prototype.strftime.formatCodes.matcher)){j+=m.slice(0,l.index);j+=(l[1]||"")+h(this,l[2]);m=m.slice(l.index+l[0].length)}else{j+=m;m=""}}return j},getShortYear:function(){return this.getYear()%100},getMonthNumber:function(){return this.getMonth()+1},getMonthName:function(){return Date.MONTHNAMES[this.getMonth()]},getAbbrMonthName:function(){return Date.ABBR_MONTHNAMES[this.getMonth()]},getDayName:function(){return Date.DAYNAMES[this.getDay()]},getAbbrDayName:function(){return Date.ABBR_DAYNAMES[this.getDay()]},getDayOrdinal:function(){return Date.ORDINALNAMES[this.getDate()%10]},getHours12:function(){var j=this.getHours();return j>12?j-12:(j==0?12:j)},getAmPm:function(){return this.getHours()>=12?"PM":"AM"},getUnix:function(){return Math.round(this.getTime()/1000,0)},getGmtOffset:function(){var j=this.getTimezoneOffset()/60;var k=j<0?"+":"-";j=Math.abs(j);return k+e(Math.floor(j),2)+":"+e((j%1)*60,2)},getTimezoneName:function(){var j=/(?:\((.+)\)$| ([A-Z]{3}) )/.exec(this.toString());return j[1]||j[2]||"GMT"+this.getGmtOffset()},toYmdInt:function(){return(this.getFullYear()*10000)+(this.getMonthNumber()*100)+this.getDate()},clone:function(){return new Date(this.getTime())}};for(var a in f){Date.prototype[a]=f[a]}var b={create:function(j){if(j instanceof Date){return j}if(typeof j=="number"){return new Date(j)}var o=String(j).replace(/^\s*(.+)\s*$/,"$1"),k=0,l=Date.create.patterns.length,m;var n=o;while(k31){j=l[3];if(s