//>>built
define("dojox/charting/axis2d/Default","dojo/_base/lang,dojo/_base/array,dojo/_base/sniff,dojo/_base/declare,dojo/_base/connect,dojo/dom-geometry,./Invisible,../scaler/common,../scaler/linear,./common,dojox/gfx,dojox/lang/utils,dojox/lang/functional".split(","),function(w,I,T,P,J,V,W,X,L,Q,t,M,N){return P("dojox.charting.axis2d.Default",W,{defaultParams:{vertical:!1,fixUpper:"none",fixLower:"none",natural:!1,leftBottom:!0,includeZero:!1,fixed:!0,majorLabels:!0,minorTicks:!0,minorLabels:!0,microTicks:!1,
rotation:0,htmlLabels:!0,enableCache:!1,dropLabels:!0,labelSizeChange:!1},optionalParams:{min:0,max:1,from:0,to:1,majorTickStep:4,minorTickStep:2,microTickStep:1,labels:[],labelFunc:null,maxLabelSize:0,maxLabelCharCount:0,trailingSymbol:null,stroke:{},majorTick:{},minorTick:{},microTick:{},tick:{},font:"",fontColor:"",title:"",titleGap:0,titleFont:"",titleFontColor:"",titleOrientation:""},constructor:function(a,c){this.opt=w.clone(this.defaultParams);M.updateWithObject(this.opt,c);M.updateWithPattern(this.opt,
c,this.optionalParams);if(this.opt.enableCache)this._textFreePool=[],this._lineFreePool=[],this._textUsePool=[],this._lineUsePool=[];this._invalidMaxLabelSize=!0},setWindow:function(a,c){if(a!=this.scale)this._invalidMaxLabelSize=!0;return this.inherited(arguments)},_groupLabelWidth:function(a,c,g){if(!a.length)return 0;if(50<a.length)a.length=50;w.isObject(a[0])&&(a=N.map(a,function(a){return a.text}));g&&(a=N.map(a,function(a){return 0==w.trim(a).length?"":a.substring(0,g)+this.trailingSymbol},
this));a=a.join("<br>");return t._base._getTextBox(a,{font:c}).w||0},_getMaxLabelSize:function(a,c,g,h,f,j){if(null==this._maxLabelSize&&6==arguments.length){var e=this.opt;this.scaler.minMinorStep=this._prevMinMinorStep=0;var b=w.clone(e);delete b.to;delete b.from;var k=L.buildScaler(a,c,g,b,e.to-e.from);k.minMinorStep=0;this._majorStart=k.major.start;e=L.buildTicks(k,e);if(j&&e){var l=k=0,d=function(a){a.label&&this.push(a.label)},i=[];this.opt.majorLabels&&(I.forEach(e.major,d,i),k=this._groupLabelWidth(i,
f,b.maxLabelCharCount),b.maxLabelSize&&(k=Math.min(b.maxLabelSize,k)));i=[];this.opt.dropLabels&&this.opt.minorLabels&&(I.forEach(e.minor,d,i),l=this._groupLabelWidth(i,f,b.maxLabelCharCount),b.maxLabelSize&&(l=Math.min(b.maxLabelSize,l)));this._maxLabelSize={majLabelW:k,minLabelW:l,majLabelH:j,minLabelH:j}}else this._maxLabelSize=null}return this._maxLabelSize},calculate:function(a,c,g){this.inherited(arguments);this.scaler.minMinorStep=this._prevMinMinorStep;if((this._invalidMaxLabelSize||g!=this._oldSpan)&&
Infinity!=a&&-Infinity!=c){this._invalidMaxLabelSize=!1;if(this.opt.labelSizeChange)this._maxLabelSize=null;this._oldSpan=g;var h=this.opt,f=this.chart.theme.axis,j=h.rotation%360,e=this.chart.theme.axis.tick.labelGap,b=h.font||f.majorTick&&f.majorTick.font||f.tick&&f.tick.font,f=b?t.normalizedLength(t.splitFontString(b).size):0,b=this._getMaxLabelSize(a,c,g,j,b,f);"number"!=typeof e&&(e=4);if(b&&h.dropLabels){var h=Math.abs(Math.cos(j*Math.PI/180)),k=Math.abs(Math.sin(j*Math.PI/180));0>j&&(j+=360);
switch(j){case 0:case 180:this.vertical?j=f:(j=b.majLabelW,f=b.minLabelW);break;case 90:case 270:this.vertical?(j=b.majLabelW,f=b.minLabelW):j=f;break;default:var j=this.vertical?Math.min(b.majLabelW,f/h):Math.min(b.majLabelW,f/k),l=Math.sqrt(b.minLabelW*b.minLabelW+f*f),f=Math.min(l,this.vertical?f*h+b.minLabelW*k:b.minLabelW*h+f*k)}this.scaler.minMinorStep=this._prevMinMinorStep=Math.max(j,f)+e;this._skipInterval=this.scaler.minMinorStep<=this.scaler.minor.tick*this.scaler.bounds.scale?0:Math.floor((j+
e)/(this.scaler.major.tick*this.scaler.bounds.scale))}else this._skipInterval=0}this.ticks=L.buildTicks(this.scaler,this.opt);return this},getOffsets:function(){var a={l:0,r:0,t:0,b:0};if(!this.scaler)return a;var c=this.opt,g=this.chart.theme.axis,h=this.chart.theme.axis.tick.labelGap,f=c.titleFont||g.title&&g.title.font,g=0==c.titleGap?0:c.titleGap||g.title&&g.title.gap,j=this.chart.theme.getTick("major",c),e=this.chart.theme.getTick("minor",c),f=f?t.normalizedLength(t.splitFontString(f).size):
0,b=c.rotation%360,k=c.leftBottom,l=Math.abs(Math.cos(b*Math.PI/180)),d=Math.abs(Math.sin(b*Math.PI/180));this.trailingSymbol=void 0===c.trailingSymbol||null===c.trailingSymbol?this.trailingSymbol:c.trailingSymbol;"number"!=typeof h&&(h=4);0>b&&(b+=360);var i=this._getMaxLabelSize();if(i){var p=Math.ceil(Math.max(i.majLabelW,i.minLabelW))+1,m=Math.ceil(Math.max(i.majLabelH,i.minLabelH))+1;if(this.vertical)switch(i=k?"l":"r",b){case 0:case 180:a[i]=p;a.t=a.b=m/2;break;case 90:case 270:a[i]=m;a.t=a.b=
p/2;break;default:45>=b||180<b&&225>=b?(a[i]=m*d/2+p*l,a[k?"t":"b"]=m*l/2+p*d,a[k?"b":"t"]=m*l/2):315<b||180>b&&135<b?(a[i]=m*d/2+p*l,a[k?"b":"t"]=m*l/2+p*d,a[k?"t":"b"]=m*l/2):90>b||180<b&&270>b?(a[i]=m*d+p*l,a[k?"t":"b"]=m*l+p*d):(a[i]=m*d+p*l,a[k?"b":"t"]=m*l+p*d)}else switch(i=k?"b":"t",b){case 0:case 180:a[i]=m;a.l=a.r=p/2;break;case 90:case 270:a[i]=p;a.l=a.r=m/2;break;default:45<=b&&90>=b||225<=b&&270>=b?(a[i]=m*l/2+p*d,a[k?"r":"l"]=m*d/2+p*l,a[k?"l":"r"]=m*d/2):90<=b&&135>=b||270<=b&&315>=
b?(a[i]=m*l/2+p*d,a[k?"l":"r"]=m*d/2+p*l,a[k?"r":"l"]=m*d/2):45>b||180<b&&225>b?(a[i]=m*l+p*d,a[k?"r":"l"]=m*d+p*l):(a[i]=m*l+p*d,a[k?"l":"r"]=m*d+p*l)}a[i]+=h+Math.max(j.length,e.length)+(c.title?f+g:0)}return a},cleanGroup:function(a){if(this.opt.enableCache&&this.group)this._lineFreePool=this._lineFreePool.concat(this._lineUsePool),this._lineUsePool=[],this._textFreePool=this._textFreePool.concat(this._textUsePool),this._textUsePool=[];this.inherited(arguments)},createText:function(a,c,g,h,f,j,
e,b,k){if(!this.opt.enableCache||"html"==a)return Q.createText[a](this.chart,c,g,h,f,j,e,b,k);0<this._textFreePool.length?(a=this._textFreePool.pop(),a.setShape({x:g,y:h,text:j,align:f}),c.add(a)):a=Q.createText[a](this.chart,c,g,h,f,j,e,b);this._textUsePool.push(a);return a},createLine:function(a,c){var g;this.opt.enableCache&&0<this._lineFreePool.length?(g=this._lineFreePool.pop(),g.setShape(c),a.add(g)):g=a.createLine(c);this.opt.enableCache&&this._lineUsePool.push(g);return g},render:function(a,
c){var g,h,f,j,e,b,k,l,d,i,p,m,C,D;if(!this.dirty||!this.scaler)return this;var q=this.opt;d=this.chart.theme.axis;var v=q.leftBottom,o=q.rotation%360,s=0,z,n,s=this.chart.theme.axis.tick.labelGap,x=q.font||d.majorTick&&d.majorTick.font||d.tick&&d.tick.font,w=q.titleFont||d.title&&d.title.font,J=q.fontColor||d.majorTick&&d.majorTick.fontColor||d.tick&&d.tick.fontColor||"black",M=q.titleFontColor||d.title&&d.title.fontColor||"black";e=0==q.titleGap?0:q.titleGap||d.title&&d.title.gap||15;var u=q.titleOrientation||
d.title&&d.title.orientation||"axis",F=this.chart.theme.getTick("major",q),G=this.chart.theme.getTick("minor",q),O=this.chart.theme.getTick("micro",q);Math.max(F.length,G.length,O.length);var N="stroke"in q?q.stroke:d.stroke,r=x?t.normalizedLength(t.splitFontString(x).size):0;b=Math.abs(Math.cos(o*Math.PI/180));z=Math.abs(Math.sin(o*Math.PI/180));var H=w?t.normalizedLength(t.splitFontString(w).size):0;"number"!=typeof s&&(s=4);0>o&&(o+=360);var K=this._getMaxLabelSize(),K=K&&K.majLabelW;if(this.vertical){C=
a.height-c.b;D=void 0;p=c.t;m=void 0;d=(a.height-c.b+c.t)/2;i=void 0;z=r*z+(K||0)*b+s+Math.max(F.length,G.length)+H+e;k=0;l=-1;g=0;h=0;e=1;b=0;f=s;j=0;switch(o){case 0:n="end";h=0.4*r;break;case 90:n="middle";g=-r;break;case 180:n="start";h=0.4*-r;break;case 270:n="middle";break;default:45>o?(n="end",h=0.4*r):90>o?(n="end",h=0.4*r):135>o?n="start":225>o?(n="start",h=0.4*-r):270>o?(n="start",g=v?0:0.4*r):315>o?(n="end",g=v?0:0.4*r):(n="end",h=0.4*r)}if(v)D=m=c.l,s=u&&"away"==u?90:270,i=c.l-z+(270==
s?H:0),e=-1,f=-f;else switch(D=m=a.width-c.r,s=u&&"axis"==u?90:270,i=a.width-c.r+z-(270==s?0:H),n){case "start":n="end";break;case "end":n="start";break;case "middle":g+=r}}else{D=c.l;C=void 0;m=a.width-c.r;p=void 0;i=(a.width-c.r+c.l)/2;d=void 0;z=r*b+(K||0)*z+s+Math.max(F.length,G.length)+H+e;k=1;l=0;g=0;h=0;e=0;b=1;f=0;j=s;switch(o){case 0:n="middle";h=r;break;case 90:n="start";g=0.4*-r;break;case 180:n="middle";break;case 270:n="end";g=0.4*r;break;default:45>o?(n="start",h=v?r:0):135>o?(n="start",
g=0.4*-r):180>o?(n="start",h=v?0:-r):225>o?(n="end",h=v?0:-r):315>o?(n="end",h=v?0.4*r:0):(n="end",h=v?r:0)}if(v)C=p=a.height-c.b,s=u&&"axis"==u?180:0,d=a.height-c.b+z-(s?H:0);else switch(C=p=c.t,s=u&&"away"==u?180:0,d=c.t-z+(s?0:H),b=-1,j=-j,n){case "start":n="end";break;case "end":n="start";break;case "middle":h-=r}}this.cleanGroup();var E=this.group,v=this.scaler,u=this.ticks,R=L.getTransformerFromModel(this.scaler),y=(!q.title||!s)&&!o&&this.opt.htmlLabels&&!T("ie")&&!T("opera")?"html":"gfx",
A=e*F.length,B=b*F.length,S=this._skipInterval;E.createLine({x1:D,y1:C,x2:m,y2:p}).setStroke(N);q.title&&(w=Q.createText[y](this.chart,E,i,d,"middle",q.title,w,M),"html"==y?this.htmlElements.push(w):w.setTransform(t.matrix.rotategAt(s,i,d)));if(null==u)return this.dirty=!1,this;var P=0<u.major.length?(u.major[0].value-this._majorStart)/v.major.tick:0,U=this.opt.majorLabels;I.forEach(u.major,function(a,b){var c=R(a.value),d=D+k*c,i=C+l*c,b=b+P;this.createLine(E,{x1:d,y1:i,x2:d+A,y2:i+B}).setStroke(F);
if(a.label&&(!S||0==(b-(1+S))%(1+S))){var e=q.maxLabelCharCount?this.getTextWithLimitCharCount(a.label,x,q.maxLabelCharCount):{text:a.label,truncated:!1},e=q.maxLabelSize?this.getTextWithLimitLength(e.text,x,q.maxLabelSize,e.truncated):e,c=this.createText(y,E,d+A+f+(o?0:g),i+B+j+(o?0:h),n,e.text,x,J);this.chart.truncateBidi&&e.truncated&&this.chart.truncateBidi(c,a.label,y);e.truncated&&this.labelTooltip(c,this.chart,a.label,e.text,x,y);"html"==y?this.htmlElements.push(c):o&&c.setTransform([{dx:g,
dy:h},t.matrix.rotategAt(o,d+A+f,i+B+j)])}},this);A=e*G.length;B=b*G.length;U=this.opt.minorLabels&&v.minMinorStep<=v.minor.tick*v.bounds.scale;I.forEach(u.minor,function(a){var b=R(a.value),c=D+k*b,d=C+l*b;this.createLine(E,{x1:c,y1:d,x2:c+A,y2:d+B}).setStroke(G);if(U&&a.label){var e=q.maxLabelCharCount?this.getTextWithLimitCharCount(a.label,x,q.maxLabelCharCount):{text:a.label,truncated:!1},e=q.maxLabelSize?this.getTextWithLimitLength(e.text,x,q.maxLabelSize,e.truncated):e,b=this.createText(y,E,
c+A+f+(o?0:g),d+B+j+(o?0:h),n,e.text,x,J);this.chart.getTextDir&&e.truncated&&this.chart.truncateBidi(b,a.label,y);e.truncated&&this.labelTooltip(b,this.chart,a.label,e.text,x,y);"html"==y?this.htmlElements.push(b):o&&b.setTransform([{dx:g,dy:h},t.matrix.rotategAt(o,c+A+f,d+B+j)])}},this);A=e*O.length;B=b*O.length;I.forEach(u.micro,function(a){var b=R(a.value),a=D+k*b,b=C+l*b;this.createLine(E,{x1:a,y1:b,x2:a+A,y2:b+B}).setStroke(O)},this);this.dirty=!1;return this},labelTooltip:function(a,c,g,h,
f,j){var e=["dijit/Tooltip"],b={type:"rect"},k=["above","below"],h=t._base._getTextBox(h,{font:f}).w||0,f=f?t.normalizedLength(t.splitFontString(f).size):0;"html"==j?(w.mixin(b,V.position(a.firstChild,!0)),b.width=Math.ceil(h),b.height=Math.ceil(f),this._events.push({shape:dojo,handle:J.connect(a.firstChild,"onmouseover",this,function(){require(e,function(a){a.show(g,b,k)})})}),this._events.push({shape:dojo,handle:J.connect(a.firstChild,"onmouseout",this,function(){require(e,function(a){a.hide(b)})})})):
(j=a.getShape(),c=c.getCoords(),b=w.mixin(b,{x:j.x-h/2,y:j.y}),b.x+=c.x,b.y+=c.y,b.x=Math.round(b.x),b.y=Math.round(b.y),b.width=Math.ceil(h),b.height=Math.ceil(f),this._events.push({shape:a,handle:a.connect("onmouseenter",this,function(){require(e,function(a){a.show(g,b,k)})})}),this._events.push({shape:a,handle:a.connect("onmouseleave",this,function(){require(e,function(a){a.hide(b)})})}))}})});