//>>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"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,g,du,df){var _b=4,_c=45;return _4("dojox.charting.axis2d.Default",_7,{defaultParams:{vertical:false,fixUpper:"none",fixLower:"none",natural:false,leftBottom:true,includeZero:false,fixed:true,majorLabels:true,minorTicks:true,minorLabels:true,microTicks:false,rotation:0,htmlLabels:true,enableCache:false,dropLabels:true},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(_d,_e){this.opt=_1.clone(this.defaultParams);du.updateWithObject(this.opt,_e);du.updateWithPattern(this.opt,_e,this.optionalParams);if(this.opt.enableCache){this._textFreePool=[];this._lineFreePool=[];this._textUsePool=[];this._lineUsePool=[];}this._invalidMaxLabelSize=true;},setWindow:function(_f,_10){if(_f!=this.scale){this._invalidMaxLabelSize=true;}return this.inherited(arguments);},_groupLabelWidth:function(_11,_12,_13){if(!_11.length){return 0;}if(_1.isObject(_11[0])){_11=df.map(_11,function(_14){return _14.text;});}if(_13){_11=df.map(_11,function(_15){return _1.trim(_15).length==0?"":_15.substring(0,_13)+this.trailingSymbol;},this);}var s=_11.join("<br>");return g._base._getTextBox(s,{font:_12}).w||0;},_getMaxLabelSize:function(min,max,_16,_17,_18,_19){if(this._maxLabelSize==null&&arguments.length==6){var o=this.opt;this.scaler.minMinorStep=this._prevMinMinorStep=0;var ob=_1.clone(o);delete o.to;delete o.from;var sb=_9.buildScaler(min,max,_16,o);sb.minMinorStep=0;this._majorStart=sb.major.start;var tb=_9.buildTicks(sb,o);if(_19&&tb){var _1a=0,_1b=0;var _1c=function(_1d){if(_1d.label){this.push(_1d.label);}};var _1e=[];if(this.opt.majorLabels){_2.forEach(tb.major,_1c,_1e);_1a=this._groupLabelWidth(_1e,_18,o.maxLabelCharCount);if(o.maxLabelSize){_1a=Math.min(o.maxLabelSize,_1a);}}_1e=[];if(this.opt.dropLabels&&this.opt.minorLabels){_2.forEach(tb.minor,_1c,_1e);_1b=this._groupLabelWidth(_1e,_18,o.maxLabelCharCount);if(o.maxLabelSize){_1b=Math.min(o.maxLabelSize,_1b);}}this._maxLabelSize={majLabelW:_1a,minLabelW:_1b,majLabelH:_19,minLabelH:_19};}else{this._maxLabelSize=null;}}return this._maxLabelSize;},calculate:function(min,max,_1f){this.inherited(arguments);this.scaler.minMinorStep=this._prevMinMinorStep;if((this._invalidMaxLabelSize||_1f!=this._oldSpan)&&(min!=Infinity&&max!=-Infinity)){this._invalidMaxLabelSize=false;this._oldSpan=_1f;var o=this.opt;var ta=this.chart.theme.axis,_20=o.rotation%360,_21=o.font||(ta.majorTick&&ta.majorTick.font)||(ta.tick&&ta.tick.font),_22=_21?g.normalizedLength(g.splitFontString(_21).size):0;var _23=this._getMaxLabelSize(min,max,_1f,_20,_21,_22);if(_23&&o.dropLabels){var _24=Math.abs(Math.cos(_20*Math.PI/180)),_25=Math.abs(Math.sin(_20*Math.PI/180));var _26,_27;if(_20<0){_20+=360;}switch(_20){case 0:case 180:if(this.vertical){_26=_27=_22;}else{_26=_23.majLabelW;_27=_23.minLabelW;}break;case 90:case 270:if(this.vertical){_26=_23.majLabelW;_27=_23.minLabelW;}else{_26=_27=_22;}break;default:_26=this.vertical?Math.min(_23.majLabelW,_22/_24):Math.min(_23.majLabelW,_22/_25);var _28=Math.sqrt(_23.minLabelW*_23.minLabelW+_22*_22),_29=this.vertical?_22*_24+_23.minLabelW*_25:_23.minLabelW*_24+_22*_25;_27=Math.min(_28,_29);break;}this.scaler.minMinorStep=this._prevMinMinorStep=Math.max(_26,_27)+_b;var _2a=this.scaler.minMinorStep<=this.scaler.minor.tick*this.scaler.bounds.scale;if(!_2a){this._skipInterval=Math.floor((_26+_b)/(this.scaler.major.tick*this.scaler.bounds.scale));}else{this._skipInterval=0;}}else{this._skipInterval=0;}}this.ticks=_9.buildTicks(this.scaler,this.opt);return this;},getOffsets:function(){var s=this.scaler,_2b={l:0,r:0,t:0,b:0};if(!s){return _2b;}var o=this.opt,a,b,c,d,gl=_8.getNumericLabel,_2c=0,ma=s.major,mi=s.minor,ta=this.chart.theme.axis,_2d=o.titleFont||(ta.title&&ta.title.font),_2e=(o.titleGap==0)?0:o.titleGap||(ta.title&&ta.title.gap),_2f=this.chart.theme.getTick("major",o),_30=this.chart.theme.getTick("minor",o),_31=_2d?g.normalizedLength(g.splitFontString(_2d).size):0,_32=o.rotation%360,_33=o.leftBottom,_34=Math.abs(Math.cos(_32*Math.PI/180)),_35=Math.abs(Math.sin(_32*Math.PI/180));this.trailingSymbol=(o.trailingSymbol===undefined||o.trailingSymbol===null)?this.trailingSymbol:o.trailingSymbol;if(_32<0){_32+=360;}var _36=this._getMaxLabelSize();if(_36){var _37;var _38=_36.majLabelW,_39=_36.majLabelH;if(this.vertical){_37=_33?"l":"r";switch(_32){case 0:case 180:_2b[_37]=_38;_2b.t=_2b.b=_39/2;break;case 90:case 270:_2b[_37]=_39;_2b.t=_2b.b=_38/2;break;default:if(_32<=_c||(180<_32&&_32<=(180+_c))){_2b[_37]=_39*_35/2+_38*_34;_2b[_33?"t":"b"]=_39*_34/2+_38*_35;_2b[_33?"b":"t"]=_39*_34/2;}else{if(_32>(360-_c)||(180>_32&&_32>(180-_c))){_2b[_37]=_39*_35/2+_38*_34;_2b[_33?"b":"t"]=_39*_34/2+_38*_35;_2b[_33?"t":"b"]=_39*_34/2;}else{if(_32<90||(180<_32&&_32<270)){_2b[_37]=_39*_35+_38*_34;_2b[_33?"t":"b"]=_39*_34+_38*_35;}else{_2b[_37]=_39*_35+_38*_34;_2b[_33?"b":"t"]=_39*_34+_38*_35;}}}break;}_2b[_37]+=_b+Math.max(_2f.length,_30.length)+(o.title?(_31+_2e):0);}else{_37=_33?"b":"t";switch(_32){case 0:case 180:_2b[_37]=_39;_2b.l=_2b.r=_38/2;break;case 90:case 270:_2b[_37]=_38;_2b.l=_2b.r=_39/2;break;default:if((90-_c)<=_32&&_32<=90||(270-_c)<=_32&&_32<=270){_2b[_37]=_39*_34/2+_38*_35;_2b[_33?"r":"l"]=_39*_35/2+_38*_34;_2b[_33?"l":"r"]=_39*_35/2;}else{if(90<=_32&&_32<=(90+_c)||270<=_32&&_32<=(270+_c)){_2b[_37]=_39*_34/2+_38*_35;_2b[_33?"l":"r"]=_39*_35/2+_38*_34;_2b[_33?"r":"l"]=_39*_35/2;}else{if(_32<_c||(180<_32&&_32<(180+_c))){_2b[_37]=_39*_34+_38*_35;_2b[_33?"r":"l"]=_39*_35+_38*_34;}else{_2b[_37]=_39*_34+_38*_35;_2b[_33?"l":"r"]=_39*_35+_38*_34;}}}break;}_2b[_37]+=_b+Math.max(_2f.length,_30.length)+(o.title?(_31+_2e):0);}}return _2b;},cleanGroup:function(_3a){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(_3b,_3c,x,y,_3d,_3e,_3f,_40,_41){if(!this.opt.enableCache||_3b=="html"){return _a.createText[_3b](this.chart,_3c,x,y,_3d,_3e,_3f,_40,_41);}var _42;if(this._textFreePool.length>0){_42=this._textFreePool.pop();_42.setShape({x:x,y:y,text:_3e,align:_3d});_3c.add(_42);}else{_42=_a.createText[_3b](this.chart,_3c,x,y,_3d,_3e,_3f,_40);}this._textUsePool.push(_42);return _42;},createLine:function(_43,_44){var _45;if(this.opt.enableCache&&this._lineFreePool.length>0){_45=this._lineFreePool.pop();_45.setShape(_44);_43.add(_45);}else{_45=_43.createLine(_44);}if(this.opt.enableCache){this._lineUsePool.push(_45);}return _45;},render:function(dim,_46){if(!this.dirty||!this.scaler){return this;}var o=this.opt,ta=this.chart.theme.axis,_47=o.leftBottom,_48=o.rotation%360,_49,_4a,_4b,_4c=0,_4d,_4e,_4f,_50,_51,_52,_53=o.font||(ta.majorTick&&ta.majorTick.font)||(ta.tick&&ta.tick.font),_54=o.titleFont||(ta.title&&ta.title.font),_55=o.fontColor||(ta.majorTick&&ta.majorTick.fontColor)||(ta.tick&&ta.tick.fontColor)||"black",_56=o.titleFontColor||(ta.title&&ta.title.fontColor)||"black",_57=(o.titleGap==0)?0:o.titleGap||(ta.title&&ta.title.gap)||15,_58=o.titleOrientation||(ta.title&&ta.title.orientation)||"axis",_59=this.chart.theme.getTick("major",o),_5a=this.chart.theme.getTick("minor",o),_5b=this.chart.theme.getTick("micro",o),_5c=Math.max(_59.length,_5a.length,_5b.length),_5d="stroke" in o?o.stroke:ta.stroke,_5e=_53?g.normalizedLength(g.splitFontString(_53).size):0,_5f=Math.abs(Math.cos(_48*Math.PI/180)),_60=Math.abs(Math.sin(_48*Math.PI/180)),_61=_54?g.normalizedLength(g.splitFontString(_54).size):0;if(_48<0){_48+=360;}var _62=this._getMaxLabelSize();_62=_62&&_62.majLabelW;if(this.vertical){_49={y:dim.height-_46.b};_4a={y:_46.t};_4b={y:(dim.height-_46.b+_46.t)/2};_4d=_5e*_60+(_62||0)*_5f+_b+Math.max(_59.length,_5a.length)+_61+_57;_4e={x:0,y:-1};_51={x:0,y:0};_4f={x:1,y:0};_50={x:_b,y:0};switch(_48){case 0:_52="end";_51.y=_5e*0.4;break;case 90:_52="middle";_51.x=-_5e;break;case 180:_52="start";_51.y=-_5e*0.4;break;case 270:_52="middle";break;default:if(_48<_c){_52="end";_51.y=_5e*0.4;}else{if(_48<90){_52="end";_51.y=_5e*0.4;}else{if(_48<(180-_c)){_52="start";}else{if(_48<(180+_c)){_52="start";_51.y=-_5e*0.4;}else{if(_48<270){_52="start";_51.x=_47?0:_5e*0.4;}else{if(_48<(360-_c)){_52="end";_51.x=_47?0:_5e*0.4;}else{_52="end";_51.y=_5e*0.4;}}}}}}}if(_47){_49.x=_4a.x=_46.l;_4c=(_58&&_58=="away")?90:270;_4b.x=_46.l-_4d+(_4c==270?_61:0);_4f.x=-1;_50.x=-_50.x;}else{_49.x=_4a.x=dim.width-_46.r;_4c=(_58&&_58=="axis")?90:270;_4b.x=dim.width-_46.r+_4d-(_4c==270?0:_61);switch(_52){case "start":_52="end";break;case "end":_52="start";break;case "middle":_51.x+=_5e;break;}}}else{_49={x:_46.l};_4a={x:dim.width-_46.r};_4b={x:(dim.width-_46.r+_46.l)/2};_4d=_5e*_5f+(_62||0)*_60+_b+Math.max(_59.length,_5a.length)+_61+_57;_4e={x:1,y:0};_51={x:0,y:0};_4f={x:0,y:1};_50={x:0,y:_b};switch(_48){case 0:_52="middle";_51.y=_5e;break;case 90:_52="start";_51.x=-_5e*0.4;break;case 180:_52="middle";break;case 270:_52="end";_51.x=_5e*0.4;break;default:if(_48<(90-_c)){_52="start";_51.y=_47?_5e:0;}else{if(_48<(90+_c)){_52="start";_51.x=-_5e*0.4;}else{if(_48<180){_52="start";_51.y=_47?0:-_5e;}else{if(_48<(270-_c)){_52="end";_51.y=_47?0:-_5e;}else{if(_48<(270+_c)){_52="end";_51.y=_47?_5e*0.4:0;}else{_52="end";_51.y=_47?_5e:0;}}}}}}if(_47){_49.y=_4a.y=dim.height-_46.b;_4c=(_58&&_58=="axis")?180:0;_4b.y=dim.height-_46.b+_4d-(_4c?_61:0);}else{_49.y=_4a.y=_46.t;_4c=(_58&&_58=="away")?180:0;_4b.y=_46.t-_4d+(_4c?0:_61);_4f.y=-1;_50.y=-_50.y;switch(_52){case "start":_52="end";break;case "end":_52="start";break;case "middle":_51.y-=_5e;break;}}}this.cleanGroup();var s=this.group,c=this.scaler,t=this.ticks,f=_9.getTransformerFromModel(this.scaler),_63=(!o.title||!_4c)&&!_48&&this.opt.htmlLabels&&!_3("ie")&&!_3("opera")?"html":"gfx",dx=_4f.x*_59.length,dy=_4f.y*_59.length,_64=this._skipInterval;s.createLine({x1:_49.x,y1:_49.y,x2:_4a.x,y2:_4a.y}).setStroke(_5d);if(o.title){var _65=_a.createText[_63](this.chart,s,_4b.x,_4b.y,"middle",o.title,_54,_56);if(_63=="html"){this.htmlElements.push(_65);}else{_65.setTransform(g.matrix.rotategAt(_4c,_4b.x,_4b.y));}}if(t==null){this.dirty=false;return this;}var rel=(t.major.length>0)?(t.major[0].value-this._majorStart)/c.major.tick:0;_2.forEach(t.major,function(_66,i){var _67=f(_66.value),_68,x=_49.x+_4e.x*_67,y=_49.y+_4e.y*_67;i+=rel;this.createLine(s,{x1:x,y1:y,x2:x+dx,y2:y+dy}).setStroke(_59);if(_66.label&&(!_64||(i-(1+_64))%(1+_64)==0)){var _69=o.maxLabelCharCount?this.getTextWithLimitCharCount(_66.label,_53,o.maxLabelCharCount):{text:_66.label,truncated:false};_69=o.maxLabelSize?this.getTextWithLimitLength(_69.text,_53,o.maxLabelSize,_69.truncated):_69;_68=this.createText(_63,s,x+dx+_50.x+(_48?0:_51.x),y+dy+_50.y+(_48?0:_51.y),_52,_69.text,_53,_55);if(this.chart.truncateBidi&&_69.truncated){this.chart.truncateBidi(_68,_66.label,_63);}_69.truncated&&this.labelTooltip(_68,this.chart,_66.label,_69.text,_53,_63);if(_63=="html"){this.htmlElements.push(_68);}else{if(_48){_68.setTransform([{dx:_51.x,dy:_51.y},g.matrix.rotategAt(_48,x+dx+_50.x,y+dy+_50.y)]);}}}},this);dx=_4f.x*_5a.length;dy=_4f.y*_5a.length;var _6a=c.minMinorStep<=c.minor.tick*c.bounds.scale;_2.forEach(t.minor,function(_6b){var _6c=f(_6b.value),_6d,x=_49.x+_4e.x*_6c,y=_49.y+_4e.y*_6c;this.createLine(s,{x1:x,y1:y,x2:x+dx,y2:y+dy}).setStroke(_5a);if(_6a&&_6b.label){var _6e=o.maxLabelCharCount?this.getTextWithLimitCharCount(_6b.label,_53,o.maxLabelCharCount):{text:_6b.label,truncated:false};_6e=o.maxLabelSize?this.getTextWithLimitLength(_6e.text,_53,o.maxLabelSize,_6e.truncated):_6e;_6d=this.createText(_63,s,x+dx+_50.x+(_48?0:_51.x),y+dy+_50.y+(_48?0:_51.y),_52,_6e.text,_53,_55);if(this.chart.getTextDir&&_6e.truncated){this.chart.truncateBidi(_6d,_6b.label,_63);}_6e.truncated&&this.labelTooltip(_6d,this.chart,_6b.label,_6e.text,_53,_63);if(_63=="html"){this.htmlElements.push(_6d);}else{if(_48){_6d.setTransform([{dx:_51.x,dy:_51.y},g.matrix.rotategAt(_48,x+dx+_50.x,y+dy+_50.y)]);}}}},this);dx=_4f.x*_5b.length;dy=_4f.y*_5b.length;_2.forEach(t.micro,function(_6f){var _70=f(_6f.value),_71,x=_49.x+_4e.x*_70,y=_49.y+_4e.y*_70;this.createLine(s,{x1:x,y1:y,x2:x+dx,y2:y+dy}).setStroke(_5b);},this);this.dirty=false;return this;},labelTooltip:function(_72,_73,_74,_75,_76,_77){var _78=["dijit/Tooltip"];var _79={type:"rect"},_7a=["above","below"],_7b=g._base._getTextBox(_75,{font:_76}).w||0,_7c=_76?g.normalizedLength(g.splitFontString(_76).size):0;if(_77=="html"){_1.mixin(_79,_6.position(_72.firstChild,true));_79.width=Math.ceil(_7b);_79.height=Math.ceil(_7c);this._events.push({shape:dojo,handle:_5.connect(_72.firstChild,"onmouseover",this,function(e){require(_78,function(_7d){_7d.show(_74,_79,_7a);});})});this._events.push({shape:dojo,handle:_5.connect(_72.firstChild,"onmouseout",this,function(e){require(_78,function(_7e){_7e.hide(_79);});})});}else{var shp=_72.getShape(),lt=_73.getCoords();_79=_1.mixin(_79,{x:shp.x-_7b/2,y:shp.y});_79.x+=lt.x;_79.y+=lt.y;_79.x=Math.round(_79.x);_79.y=Math.round(_79.y);_79.width=Math.ceil(_7b);_79.height=Math.ceil(_7c);this._events.push({shape:_72,handle:_72.connect("onmouseenter",this,function(e){require(_78,function(_7f){_7f.show(_74,_79,_7a);});})});this._events.push({shape:_72,handle:_72.connect("onmouseleave",this,function(e){require(_78,function(_80){_80.hide(_79);});})});}}});});
