MDL-32843 import YUI 3.5.1
[moodle.git] / lib / yui / 3.5.1 / build / charts-base / charts-base-min.js
blobb9e9dfa062a59e404d9f388264b15c5ec81ecaec
1 /*
2 YUI 3.5.1 (build 22)
3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
6 */
7 YUI.add("charts-base",function(b){var A=b.config,v=A.win,g=A.doc,q=b.Lang,m=q.isString,k,p,u,a,c=b.ClassNameManager.getClassName,n=c("seriesmarker"),r,C,w,z,t;r=function(D){r.superclass.constructor.apply(this,arguments);};r.NAME="shapeGroup";b.extend(r,b.Path,{_draw:function(){var K=this.get("xvalues"),H=this.get("yvalues"),O,N,E,G,V=0,W,S=[],I=this.get("dimensions"),T=I.width,P=I.height,F=I.radius,J=I.yRadius,Q=this.get("id"),D=this.node.className,U=q.isArray(T),R=q.isArray(P),L=q.isArray(F),M=q.isArray(J);if(K&&H&&K.length>0){this.clear();W=K.length;for(;V<W;++V){O=K[V];N=H[V];E=L?F[V]:F;G=M?J[V]:J;if(!isNaN(O)&&!isNaN(N)&&!isNaN(E)){this.drawShape({x:O,y:N,width:U?T[V]:T,height:R?P[V]:P,radius:E,yRadius:G});this.closePath();S[V]={id:Q+"_"+V,className:D,coords:(O-this._left)+", "+(N-this._top)+", "+F,shape:"circle"};}}this._closePath();}},_getRadiusCollection:function(G){var E=0,D=G.length,F=[];for(;E<D;++E){F[E]=G[E]*0.5;}return F;}});r.ATTRS=b.merge(b.Path.ATTRS,{dimensions:{getter:function(){var H=this._dimensions,F,E,G,D;if(H.hasOwnProperty("radius")){return H;}else{G=H.width;D=H.height;F=q.isArray(G)?this._getRadiusCollection(G):(G*0.5);E=q.isArray(D)?this._getRadiusCollection(D):(D*0.5);return{width:G,height:D,radius:F,yRadius:E};}},setter:function(D){this._dimensions=D;return D;}},xvalues:{getter:function(){return this._xvalues;},setter:function(D){this._xvalues=D;}},yvalues:{getter:function(){return this._yvalues;},setter:function(D){this._yvalues=D;}}});b.ShapeGroup=r;C=function(D){C.superclass.constructor.apply(this,arguments);};C.NAME="circleGroup";b.extend(C,b.ShapeGroup,{drawShape:function(D){this.drawCircle(D.x,D.y,D.radius);}});C.ATTRS=b.merge(b.ShapeGroup.ATTRS,{dimensions:{getter:function(){var H=this._dimensions,F,E,G,D;if(H.hasOwnProperty("radius")){return H;}else{G=H.width;D=H.height;F=q.isArray(G)?this._getRadiusCollection(G):(G*0.5);E=F;return{width:G,height:D,radius:F,yRadius:E};}}}});C.ATTRS=b.ShapeGroup.ATTRS;b.CircleGroup=C;w=function(D){w.superclass.constructor.apply(this,arguments);};w.NAME="rectGroup";b.extend(w,b.ShapeGroup,{drawShape:function(D){this.drawRect(D.x,D.y,D.width,D.height);}});w.ATTRS=b.ShapeGroup.ATTRS;b.RectGroup=w;t=function(D){t.superclass.constructor.apply(this,arguments);};t.NAME="diamondGroup";b.extend(t,b.ShapeGroup,{drawShape:function(D){this.drawDiamond(D.x,D.y,D.width,D.height);}});t.ATTRS=b.ShapeGroup.ATTRS;b.DiamondGroup=t;z=function(D){z.superclass.constructor.apply(this,arguments);};z.NAME="diamondGroup";b.extend(z,b.ShapeGroup,{drawShape:function(D){this.drawEllipse(D.x,D.y,D.width,D.height);}});z.ATTRS=b.ShapeGroup.ATTRS;b.EllipseGroup=z;function s(){}s.ATTRS={styles:{getter:function(){this._styles=this._styles||this._getDefaultStyles();return this._styles;},setter:function(D){this._styles=this._setStyles(D);}},graphic:{}};s.NAME="renderer";s.prototype={_styles:null,_setStyles:function(E){var D=this.get("styles");return this._mergeStyles(E,D);},_mergeStyles:function(E,D){if(!D){D={};}var F=b.merge(D,{});b.Object.each(E,function(I,H,G){if(D.hasOwnProperty(H)&&q.isObject(I)&&!q.isFunction(I)&&!q.isArray(I)){F[H]=this._mergeStyles(I,D[H]);}else{F[H]=I;}},this);return F;},_getDefaultStyles:function(){return{padding:{top:0,right:0,bottom:0,left:0}};}};b.augment(s,b.Attribute);b.Renderer=s;k=function(){};k.prototype={_getDefaultMargins:function(){return{top:0,left:0,right:4,bottom:0};},setTickOffsets:function(){var F=this,H=F.get("styles").majorTicks,E=H.length,D=E*0.5,G=H.display;F.set("topTickOffset",0);F.set("bottomTickOffset",0);switch(G){case"inside":F.set("rightTickOffset",E);F.set("leftTickOffset",0);break;case"outside":F.set("rightTickOffset",0);F.set("leftTickOffset",E);break;case"cross":F.set("rightTickOffset",D);F.set("leftTickOffset",D);break;default:F.set("rightTickOffset",0);F.set("leftTickOffset",0);break;}},drawTick:function(K,L,G){var J=this,D=J.get("styles"),I=D.padding,H=G.length,E={x:I.left,y:L.y},F={x:H+I.left,y:L.y};J.drawLine(K,E,F);},getLineStart:function(){var D=this.get("styles"),H=D.padding,I=D.majorTicks,E=I.length,G=I.display,F={x:H.left,y:0};if(G==="outside"){F.x+=E;}else{if(G==="cross"){F.x+=E/2;}}return F;},getLabelPoint:function(D){return{x:D.x-this.get("leftTickOffset"),y:D.y};},updateMaxLabelSize:function(H,F){var L=this,I=this._labelRotationProps,D=I.rot,G=I.absRot,K=I.sinRadians,E=I.cosRadians,J;if(D===0){J=H;}else{if(G===90){J=F;}else{J=(E*H)+(K*F);}}L._maxLabelSize=Math.max(L._maxLabelSize,J);},getExplicitlySized:function(G){if(this._explicitWidth){var F=this,D=F._explicitWidth,E=F._totalTitleSize,I=F.get("leftTickOffset"),H=G.label.margin.right;F._maxLabelSize=D-(I+H+E);return true;}return false;},positionTitle:function(K){var M=this,D=M._titleBounds,E=M.get("styles").title.margin,H=M._titleRotationProps,L=D.right-D.left,G=K.offsetWidth,F=K.offsetHeight,J=(G*-0.5)+(L*0.5),I=(M.get("height")*0.5)-(F*0.5);H.labelWidth=G;H.labelHeight=F;if(E&&E.left){J+=E.left;}H.x=J;H.y=I;H.transformOrigin=[0.5,0.5];M._rotate(K,H);},positionLabel:function(N,R,P,I){var Q=this,O=Q.get("leftTickOffset"),K=this._totalTitleSize,F=R.x+K-O,J=R.y,M=this._labelRotationProps,E=M.rot,H=M.absRot,D=Q._maxLabelSize,L=this._labelWidths[I],G=this._labelHeights[I];if(E===0){F-=L;J-=G*0.5;}else{if(E===90){F-=L*0.5;}else{if(E===-90){F-=L*0.5;J-=G;}else{F-=L+(G*H/360);J-=G*0.5;}}}M.labelWidth=L;M.labelHeight=G;M.x=Math.round(D+F);M.y=Math.round(J);this._rotate(N,M);},_setRotationCoords:function(H){var E=H.rot,F=H.absRot,I,G,D=H.labelWidth,J=H.labelHeight;if(E===0){I=D;G=J*0.5;}else{if(E===90){G=0;I=D*0.5;}else{if(E===-90){I=D*0.5;G=J;}else{I=D+(J*F/360);G=J*0.5;}}}H.x-=I;H.y-=G;},_getTransformOrigin:function(D){var E;if(D===0){E=[0,0];}else{if(D===90){E=[0.5,0];}else{if(D===-90){E=[0.5,1];}else{E=[1,0.5];}}}return E;},offsetNodeForTick:function(D){},setCalculatedSize:function(){var I=this,K=this.get("graphic"),H=I.get("styles"),G=H.label,J=I.get("leftTickOffset"),E=I._maxLabelSize,F=this._totalTitleSize,D=Math.round(F+J+E+G.margin.right);
8 if(this._explicitWidth){D=this._explicitWidth;}this.set("calculatedWidth",D);K.set("x",D-J);}};b.LeftAxisLayout=k;p=function(){};p.prototype={_getDefaultMargins:function(){return{top:0,left:4,right:0,bottom:0};},setTickOffsets:function(){var F=this,H=F.get("styles").majorTicks,E=H.length,D=E*0.5,G=H.display;F.set("topTickOffset",0);F.set("bottomTickOffset",0);switch(G){case"inside":F.set("leftTickOffset",E);F.set("rightTickOffset",0);break;case"outside":F.set("leftTickOffset",0);F.set("rightTickOffset",E);break;case"cross":F.set("rightTickOffset",D);F.set("leftTickOffset",D);break;default:F.set("leftTickOffset",0);F.set("rightTickOffset",0);break;}},drawTick:function(K,L,G){var J=this,D=J.get("styles"),I=D.padding,H=G.length,E={x:I.left,y:L.y},F={x:I.left+H,y:L.y};J.drawLine(K,E,F);},getLineStart:function(){var F=this,D=F.get("styles"),I=D.padding,J=D.majorTicks,E=J.length,H=J.display,G={x:I.left,y:I.top};if(H==="inside"){G.x+=E;}else{if(H==="cross"){G.x+=E/2;}}return G;},getLabelPoint:function(D){return{x:D.x+this.get("rightTickOffset"),y:D.y};},updateMaxLabelSize:function(H,F){var L=this,I=this._labelRotationProps,D=I.rot,G=I.absRot,K=I.sinRadians,E=I.cosRadians,J;if(D===0){J=H;}else{if(G===90){J=F;}else{J=(E*H)+(K*F);}}L._maxLabelSize=Math.max(L._maxLabelSize,J);},getExplicitlySized:function(G){if(this._explicitWidth){var F=this,D=F._explicitWidth,E=this._totalTitleSize,I=F.get("rightTickOffset"),H=G.label.margin.right;F._maxLabelSize=D-(I+H+E);return true;}return false;},positionTitle:function(K){var M=this,D=M._titleBounds,E=M.get("styles").title.margin,H=M._titleRotationProps,G=K.offsetWidth,F=K.offsetHeight,L=D.right-D.left,J=this.get("width")-(G*0.5)-(L*0.5),I=(M.get("height")*0.5)-(F*0.5);H.labelWidth=G;H.labelHeight=F;if(E&&E.right){J-=E.left;}H.x=J;H.y=I;H.transformOrigin=[0.5,0.5];M._rotate(K,H);},positionLabel:function(N,R,P,I){var Q=this,O=Q.get("rightTickOffset"),M=P.label,F=0,E=R.x,J=R.y,L=this._labelRotationProps,D=L.rot,H=L.absRot,K=this._labelWidths[I],G=this._labelHeights[I];if(M.margin&&M.margin.left){F=M.margin.left;}if(D===0){J-=G*0.5;}else{if(D===90){E-=K*0.5;J-=G;}else{if(D===-90){E-=K*0.5;}else{J-=G*0.5;E+=G/2*H/90;}}}E+=F;E+=O;L.labelWidth=K;L.labelHeight=G;L.x=Math.round(E);L.y=Math.round(J);this._rotate(N,L);},_setRotationCoords:function(H){var E=H.rot,F=H.absRot,I=0,G=0,D=H.labelWidth,J=H.labelHeight;if(E===0){G=J*0.5;}else{if(E===90){I=D*0.5;G=J;}else{if(E===-90){I=D*0.5;}else{G=J*0.5;I=J/2*F/90;}}}H.x-=I;H.y-=G;},_getTransformOrigin:function(D){var E;if(D===0){E=[0,0];}else{if(D===90){E=[0.5,1];}else{if(D===-90){E=[0.5,0];}else{E=[0,0.5];}}}return E;},offsetNodeForTick:function(D){var E=this,G=E.get("leftTickOffset"),F=0-G;D.setStyle("left",F);},setCalculatedSize:function(){var H=this,G=H.get("styles"),E=G.label,F=this._totalTitleSize,D=Math.round(H.get("rightTickOffset")+H._maxLabelSize+F+E.margin.left);if(this._explicitWidth){D=this._explicitWidth;}H.set("calculatedWidth",D);H.get("contentBox").setStyle("width",D);}};b.RightAxisLayout=p;u=function(){};u.prototype={_getDefaultMargins:function(){return{top:4,left:0,right:0,bottom:0};},setTickOffsets:function(){var F=this,H=F.get("styles").majorTicks,E=H.length,D=E*0.5,G=H.display;F.set("leftTickOffset",0);F.set("rightTickOffset",0);switch(G){case"inside":F.set("topTickOffset",E);F.set("bottomTickOffset",0);break;case"outside":F.set("topTickOffset",0);F.set("bottomTickOffset",E);break;case"cross":F.set("topTickOffset",D);F.set("bottomTickOffset",D);break;default:F.set("topTickOffset",0);F.set("bottomTickOffset",0);break;}},getLineStart:function(){var D=this.get("styles"),H=D.padding,I=D.majorTicks,E=I.length,G=I.display,F={x:0,y:H.top};if(G==="inside"){F.y+=E;}else{if(G==="cross"){F.y+=E/2;}}return F;},drawTick:function(K,L,G){var J=this,D=J.get("styles"),I=D.padding,H=G.length,E={x:L.x,y:I.top},F={x:L.x,y:H+I.top};J.drawLine(K,E,F);},getLabelPoint:function(D){return{x:D.x,y:D.y+this.get("bottomTickOffset")};},updateMaxLabelSize:function(H,F){var L=this,I=this._labelRotationProps,D=I.rot,G=I.absRot,K=I.sinRadians,E=I.cosRadians,J;if(D===0){J=F;}else{if(G===90){J=H;}else{J=(K*H)+(E*F);}}L._maxLabelSize=Math.max(L._maxLabelSize,J);},getExplicitlySized:function(H){if(this._explicitHeight){var G=this,E=G._explicitHeight,D=G._totalTitleSize,F=G.get("bottomTickOffset"),I=H.label.margin.right;G._maxLabelSize=E-(F+I+D);return true;}return false;},positionTitle:function(L){var M=this,D=M._titleBounds,E=M.get("styles").title.margin,I=M._titleRotationProps,G=D.bottom-D.top,H=L.offsetWidth,F=L.offsetHeight,K=(M.get("width")*0.5)-(H*0.5),J=M.get("height")-F/2-G/2;I.labelWidth=H;I.labelHeight=F;if(E&&E.bottom){J-=E.bottom;}I.x=K;I.y=J;I.transformOrigin=[0.5,0.5];M._rotate(L,I);},positionLabel:function(N,R,P,I){var Q=this,O=Q.get("bottomTickOffset"),M=P.label,F=0,L=Q._labelRotationProps,E=L.rot,H=L.absRot,D=Math.round(R.x),J=Math.round(R.y),K=Q._labelWidths[I],G=Q._labelHeights[I];if(M.margin&&M.margin.top){F=M.margin.top;}if(E>0){J-=G/2*E/90;}else{if(E<0){D-=K;J-=G/2*H/90;}else{D-=K*0.5;}}J+=F;J+=O;L.labelWidth=K;L.labelHeight=G;L.x=D;L.y=J;Q._rotate(N,L);},_setRotationCoords:function(H){var E=H.rot,F=H.absRot,D=H.labelWidth,J=H.labelHeight,I,G;if(E>0){I=0;G=J/2*E/90;}else{if(E<0){I=D;G=J/2*F/90;}else{I=D*0.5;G=0;}}H.x-=I;H.y-=G;},_getTransformOrigin:function(D){var E;if(D>0){E=[0,0.5];}else{if(D<0){E=[1,0.5];}else{E=[0,0];}}return E;},offsetNodeForTick:function(D){var E=this;E.get("contentBox").setStyle("top",0-E.get("topTickOffset"));},setCalculatedSize:function(){var H=this,G=H.get("styles"),E=G.label,F=H._totalTitleSize,D=Math.round(H.get("bottomTickOffset")+H._maxLabelSize+E.margin.top+F);if(H._explicitHeight){D=H._explicitHeight;}H.set("calculatedHeight",D);}};b.BottomAxisLayout=u;a=function(){};a.prototype={_getDefaultMargins:function(){return{top:0,left:0,right:0,bottom:4};},setTickOffsets:function(){var F=this,H=F.get("styles").majorTicks,E=H.length,D=E*0.5,G=H.display;F.set("leftTickOffset",0);F.set("rightTickOffset",0);
9 switch(G){case"inside":F.set("bottomTickOffset",E);F.set("topTickOffset",0);break;case"outside":F.set("bottomTickOffset",0);F.set("topTickOffset",E);break;case"cross":F.set("topTickOffset",D);F.set("bottomTickOffset",D);break;default:F.set("topTickOffset",0);F.set("bottomTickOffset",0);break;}},getLineStart:function(){var F=this,D=F.get("styles"),I=D.padding,J=D.majorTicks,E=J.length,H=J.display,G={x:0,y:I.top};if(H==="outside"){G.y+=E;}else{if(H==="cross"){G.y+=E/2;}}return G;},drawTick:function(K,L,G){var J=this,D=J.get("styles"),I=D.padding,H=G.length,E={x:L.x,y:I.top},F={x:L.x,y:H+I.top};J.drawLine(K,E,F);},getLabelPoint:function(D){return{x:D.x,y:D.y-this.get("topTickOffset")};},updateMaxLabelSize:function(H,F){var L=this,I=this._labelRotationProps,D=I.rot,G=I.absRot,K=I.sinRadians,E=I.cosRadians,J;if(D===0){J=F;}else{if(G===90){J=H;}else{J=(K*H)+(E*F);}}L._maxLabelSize=Math.max(L._maxLabelSize,J);},getExplicitlySized:function(G){if(this._explicitHeight){var F=this,E=F._explicitHeight,D=F._totalTitleSize,I=F.get("topTickOffset"),H=G.label.margin.right;F._maxLabelSize=E-(I+H+D);return true;}return false;},positionTitle:function(L){var M=this,D=M._titleBounds,E=M.get("styles").title.margin,I=M._titleRotationProps,H=L.offsetWidth,F=L.offsetHeight,G=D.bottom-D.top,K=(M.get("width")*0.5)-(H*0.5),J=G/2-F/2;I.labelWidth=H;I.labelHeight=F;if(E&&E.top){J+=E.top;}I.x=K;I.y=J;I.transformOrigin=[0.5,0.5];M._rotate(L,I);},positionLabel:function(N,Q,O,I){var P=this,K=this._totalTitleSize,D=P._maxLabelSize,F=Q.x,J=Q.y+K+D,M=this._labelRotationProps,E=M.rot,H=M.absRot,L=this._labelWidths[I],G=this._labelHeights[I];if(E===0){F-=L*0.5;J-=G;}else{if(E===90){F-=L;J-=(G*0.5);}else{if(E===-90){J-=(G*0.5);}else{if(E>0){F-=L;J-=G-(G*E/180);}else{J-=G-(G*H/180);}}}}M.x=Math.round(F);M.y=Math.round(J);M.labelWidth=L;M.labelHeight=G;this._rotate(N,M);},_setRotationCoords:function(H){var E=H.rot,F=H.absRot,D=H.labelWidth,J=H.labelHeight,I,G;if(E===0){I=D*0.5;G=J;}else{if(E===90){I=D;G=(J*0.5);}else{if(E===-90){G=(J*0.5);}else{if(E>0){I=D;G=J-(J*E/180);}else{G=J-(J*F/180);}}}}H.x-=I;H.y-=G;},_getTransformOrigin:function(D){var E;if(D===0){E=[0,0];}else{if(D===90){E=[1,0.5];}else{if(D===-90){E=[0,0.5];}else{if(D>0){E=[1,0.5];}else{E=[0,0.5];}}}}return E;},offsetNodeForTick:function(D){},setCalculatedSize:function(){var H=this,K=H.get("graphic"),G=H.get("styles"),F=G.label.margin,J=F.bottom+H._maxLabelSize,E=H._totalTitleSize,I=this.get("topTickOffset"),D=Math.round(I+J+E);if(this._explicitHeight){D=this._explicitWidth;}H.set("calculatedHeight",D);K.set("y",D-I);}};b.TopAxisLayout=a;b.Axis=b.Base.create("axis",b.Widget,[b.Renderer],{_calculatedWidth:0,_calculatedHeight:0,_dataChangeHandler:function(D){if(this.get("rendered")){this._drawAxis();}},_positionChangeHandler:function(D){this._updateGraphic(D.newVal);this._updateHandler();},_updateGraphic:function(D){var E=this.get("graphic");if(D=="none"){if(E){E.destroy();}}else{if(!E){this._setCanvas();}}},_updateHandler:function(D){if(this.get("rendered")){this._drawAxis();}},renderUI:function(){this._updateGraphic(this.get("position"));},syncUI:function(){var H=this._layout,G,F,D,I,E;if(H){G=H._getDefaultMargins();F=this.get("styles");D=F.label.margin;I=F.title.margin;for(E in G){if(G.hasOwnProperty(E)){D[E]=D[E]===undefined?G[E]:D[E];I[E]=I[E]===undefined?G[E]:I[E];}}}this._drawAxis();},_setCanvas:function(){var D=this.get("contentBox"),I=this.get("boundingBox"),H=this.get("position"),F=this._parentNode,E=this.get("width"),G=this.get("height");I.setStyle("position","absolute");I.setStyle("zIndex",2);E=E?E+"px":F.getStyle("width");G=G?G+"px":F.getStyle("height");if(H==="top"||H==="bottom"){D.setStyle("width",E);}else{D.setStyle("height",G);}D.setStyle("position","relative");D.setStyle("left","0px");D.setStyle("top","0px");this.set("graphic",new b.Graphic());this.get("graphic").render(D);},_getDefaultStyles:function(){var D={majorTicks:{display:"inside",length:4,color:"#dad8c9",weight:1,alpha:1},minorTicks:{display:"none",length:2,color:"#dad8c9",weight:1},line:{weight:1,color:"#dad8c9",alpha:1},majorUnit:{determinant:"count",count:11,distance:75},top:"0px",left:"0px",width:"100px",height:"100px",label:{color:"#808080",alpha:1,fontSize:"85%",rotation:0,margin:{top:undefined,right:undefined,bottom:undefined,left:undefined}},title:{color:"#808080",alpha:1,fontSize:"85%",rotation:undefined,margin:{top:undefined,right:undefined,bottom:undefined,left:undefined}},hideOverlappingLabelTicks:false};return b.merge(b.Renderer.prototype._getDefaultStyles(),D);},_handleSizeChange:function(G){var F=G.attrName,I=this.get("position"),E=I=="left"||I=="right",D=this.get("contentBox"),H=I=="bottom"||I=="top";D.setStyle("width",this.get("width"));D.setStyle("height",this.get("height"));if((H&&F=="width")||(E&&F=="height")){this._drawAxis();}},_layoutClasses:{top:a,bottom:u,left:k,right:p},drawLine:function(F,E,D){F.moveTo(E.x,E.y);F.lineTo(D.x,D.y);},_getTextRotationProps:function(H){if(H.rotation===undefined){switch(this.get("position")){case"left":H.rotation=-90;break;case"right":H.rotation=90;break;default:H.rotation=0;break;}}var E=Math.min(90,Math.max(-90,H.rotation)),G=Math.abs(E),F=Math.PI/180,I=parseFloat(parseFloat(Math.sin(G*F)).toFixed(8)),D=parseFloat(parseFloat(Math.cos(G*F)).toFixed(8));return{rot:E,absRot:G,radCon:F,sinRadians:I,cosRadians:D,textAlpha:H.alpha};},_drawAxis:function(){if(this._drawing){this._callLater=true;return;}this._drawing=true;this._callLater=false;if(this._layout){var L=this.get("styles"),N=L.line,J=L.label,Z=L.majorTicks,D=Z.display!="none",M,G=L.majorUnit,W,U,V=0,X=this._layout,T,aa,P,K,Y,E,I=this.get("labelFunction"),F=this.get("labelFunctionScope"),H=this.get("labelFormat"),O=this.get("graphic"),Q=this.get("path"),R,S;this._labelWidths=[];this._labelHeights=[];O.set("autoDraw",false);Q.clear();Q.set("stroke",{weight:N.weight,color:N.color,opacity:N.alpha});this._labelRotationProps=this._getTextRotationProps(J);this._labelRotationProps.transformOrigin=X._getTransformOrigin(this._labelRotationProps.rot);
10 X.setTickOffsets.apply(this);T=this.getLength();P=X.getLineStart.apply(this);W=this.getTotalMajorUnits(G);U=this.getMajorUnitDistance(W,T,G);this.set("edgeOffset",this.getEdgeOffset(W,T)*0.5);if(W<1){this._clearLabelCache();}else{M=this.getFirstPoint(P);this.drawLine(Q,P,this.getLineEnd(M));if(D){R=this.get("tickPath");R.clear();R.set("stroke",{weight:Z.weight,color:Z.color,opacity:Z.alpha});X.drawTick.apply(this,[R,M,Z]);}this._createLabelCache();this._tickPoints=[];this._maxLabelSize=0;this._totalTitleSize=0;this._titleSize=0;this._setTitle();S=X.getExplicitlySized.apply(this,[L]);for(;V<W;++V){if(D){X.drawTick.apply(this,[R,M,Z]);}aa=this.getPosition(M);K=this.getLabel(M,J);this._labels.push(K);this._tickPoints.push({x:M.x,y:M.y});this.get("appendLabelFunction")(K,I.apply(F,[this.getLabelByIndex(V,W),H]));Y=Math.round(K.offsetWidth);E=Math.round(K.offsetHeight);if(!S){this._layout.updateMaxLabelSize.apply(this,[Y,E]);}this._labelWidths.push(Y);this._labelHeights.push(E);M=this.getNextPoint(M,U);}this._clearLabelCache();if(this.get("overlapGraph")){X.offsetNodeForTick.apply(this,[this.get("contentBox")]);}X.setCalculatedSize.apply(this);if(this._titleTextField){this._layout.positionTitle.apply(this,[this._titleTextField]);}for(V=0;V<W;++V){X.positionLabel.apply(this,[this.get("labels")[V],this._tickPoints[V],L,V]);}}}this._drawing=false;if(this._callLater){this._drawAxis();}else{this._updatePathElement();this.fire("axisRendered");}},_setTotalTitleSize:function(L){var J=this._titleTextField,K=J.offsetWidth,H=J.offsetHeight,E=this._titleRotationProps.rot,D,M,F=L.margin,G=this.get("position"),I=new b.Matrix();I.rotate(E);D=I.getContentRect(K,H);if(G=="left"||G=="right"){M=D.right-D.left;if(F){M+=F.left+F.right;}}else{M=D.bottom-D.top;if(F){M+=F.top+F.bottom;}}this._titleBounds=D;this._totalTitleSize=M;},_updatePathElement:function(){var D=this._path,G=this._tickPath,E=false,F=this.get("graphic");if(D){E=true;D.end();}if(G){E=true;G.end();}if(E){F._redraw();}},_setTitle:function(){var F,H,G,I=this.get("title"),E=this._titleTextField,D;if(I!==null&&I!==undefined){G={rotation:"rotation",margin:"margin",alpha:"alpha"};H=this.get("styles").title;if(!E){E=g.createElement("span");E.style.display="block";E.style.whiteSpace="nowrap";E.setAttribute("class","axisTitle");this.get("contentBox").append(E);}else{if(!g.createElementNS){if(E.style.filter){E.style.filter=null;}}}E.style.position="absolute";for(F in H){if(H.hasOwnProperty(F)&&!G.hasOwnProperty(F)){E.style[F]=H[F];}}this.get("appendTitleFunction")(E,I);this._titleTextField=E;this._titleRotationProps=this._getTextRotationProps(H);this._setTotalTitleSize(H);}else{if(E){D=E.parentNode;if(D){D.removeChild(E);}this._titleTextField=null;this._totalTitleSize=0;}}},getLabel:function(I,G){var E,D,H=this._labelCache,F={rotation:"rotation",margin:"margin",alpha:"alpha"};if(H&&H.length>0){D=H.shift();}else{D=g.createElement("span");D.className=b.Lang.trim([D.className,"axisLabel"].join(" "));this.get("contentBox").append(D);}if(!g.createElementNS){if(D.style.filter){D.style.filter=null;}}D.style.display="block";D.style.whiteSpace="nowrap";D.style.position="absolute";for(E in G){if(G.hasOwnProperty(E)&&!F.hasOwnProperty(E)){D.style[E]=G[E];}}return D;},_createLabelCache:function(){if(this._labels){while(this._labels.length>0){this._labelCache.push(this._labels.shift());}}else{this._clearLabelCache();}this._labels=[];},_clearLabelCache:function(){if(this._labelCache){var D=this._labelCache.length,F=0,E;for(;F<D;++F){E=this._labelCache[F];this._removeChildren(E);b.Event.purgeElement(E,true);E.parentNode.removeChild(E);}}this._labelCache=[];},getLineEnd:function(F){var D=this.get("width"),E=this.get("height"),G=this.get("position");if(G==="top"||G==="bottom"){return{x:D,y:F.y};}else{return{x:F.x,y:E};}},getLength:function(){var E,G=this.get("styles"),H=G.padding,D=this.get("width"),F=this.get("height"),I=this.get("position");if(I==="top"||I==="bottom"){E=D-(H.left+H.right);}else{E=F-(H.top+H.bottom);}return E;},getFirstPoint:function(G){var D=this.get("styles"),H=this.get("position"),F=D.padding,E={x:G.x,y:G.y};if(H==="top"||H==="bottom"){E.x+=F.left+this.get("edgeOffset");}else{E.y+=this.get("height")-(F.top+this.get("edgeOffset"));}return E;},getNextPoint:function(D,E){var F=this.get("position");if(F==="top"||F==="bottom"){D.x=D.x+E;}else{D.y=D.y-E;}return D;},getLastPoint:function(){var E=this.get("styles"),F=E.padding,D=this.get("width"),G=this.get("position");if(G==="top"||G==="bottom"){return{x:D-F.right,y:F.top};}else{return{x:F.left,y:F.top};}},getPosition:function(D){var I,G=this.get("height"),F=this.get("styles"),H=F.padding,J=this.get("position"),E=this.get("dataType");if(J==="left"||J==="right"){if(E==="numeric"){I=(G-(H.top+H.bottom))-(D.y-H.top);}else{I=D.y-H.top;}}else{I=D.x-H.left;}return I;},_rotate:function(J,G){var D=G.rot,L=G.x,I=G.y,F,M,K=new b.Matrix(),E=G.transformOrigin||[0,0],H;if(g.createElementNS){K.translate(L,I);K.rotate(D);J.style.MozTransformOrigin=(E[0]*100)+"% "+(E[1]*100)+"%";J.style.MozTransform=K.toCSSText();J.style.webkitTransformOrigin=(E[0]*100)+"% "+(E[1]*100)+"%";J.style.webkitTransform=K.toCSSText();J.style.msTransformOrigin=(E[0]*100)+"% "+(E[1]*100)+"%";J.style.msTransform=K.toCSSText();J.style.OTransformOrigin=(E[0]*100)+"% "+(E[1]*100)+"%";J.style.OTransform=K.toCSSText();}else{M=G.textAlpha;if(q.isNumber(M)&&M<1&&M>-1&&!isNaN(M)){F="progid:DXImageTransform.Microsoft.Alpha(Opacity="+Math.round(M*100)+")";}if(D!==0){K.rotate(D);H=K.getContentRect(G.labelWidth,G.labelHeight);K.init();K.translate(H.left,H.top);K.translate(L,I);this._simulateRotateWithTransformOrigin(K,D,E,G.labelWidth,G.labelHeight);if(F){F+=" ";}else{F="";}F+=K.toFilterText();J.style.left=K.dx+"px";J.style.top=K.dy+"px";}else{J.style.left=L+"px";J.style.top=I+"px";}if(F){J.style.filter=F;}}},_simulateRotateWithTransformOrigin:function(F,E,G,D,H){var J=G[0]*D,I=G[1]*H;J=!isNaN(J)?J:0;I=!isNaN(I)?I:0;F.translate(J,I);F.rotate(E);F.translate(-J,-I);},getMaxLabelBounds:function(){return this._getLabelBounds(this.getMaximumValue());
11 },getMinLabelBounds:function(){return this._getLabelBounds(this.getMinimumValue());},_getLabelBounds:function(I){var H=this._layout,G=this.get("styles").label,D=new b.Matrix(),E,F=this._getTextRotationProps(G);F.transformOrigin=H._getTransformOrigin(F.rot);E=this.getLabel({x:0,y:0},G);this.get("appendLabelFunction")(E,this.get("labelFunction").apply(this,[I,this.get("labelFormat")]));F.labelWidth=E.offsetWidth;F.labelHeight=E.offsetHeight;this._removeChildren(E);b.Event.purgeElement(E,true);E.parentNode.removeChild(E);F.x=0;F.y=0;H._setRotationCoords(F);D.translate(F.x,F.y);this._simulateRotateWithTransformOrigin(D,F.rot,F.transformOrigin,F.labelWidth,F.labelHeight);return D.getContentRect(F.labelWidth,F.labelHeight);},_removeChildren:function(D){if(D.hasChildNodes()){var E;while(D.firstChild){E=D.firstChild;this._removeChildren(E);D.removeChild(E);}}},destructor:function(){var E=this.get("contentBox").getDOMNode(),H=this.get("labels"),G=this.get("graphic"),F,D=H?H.length:0;if(D>0){while(H.length>0){F=H.shift();this._removeChildren(F);E.removeChild(F);F=null;}}if(G){G.destroy();}},_maxLabelSize:0,_setText:function(D,E){D.innerHTML="";if(q.isNumber(E)){E=E+"";}else{if(!E){E="";}}if(m(E)){E=g.createTextNode(E);}D.appendChild(E);}},{ATTRS:{width:{lazyAdd:false,getter:function(){if(this._explicitWidth){return this._explicitWidth;}return this._calculatedWidth;},setter:function(D){this._explicitWidth=D;return D;}},height:{lazyAdd:false,getter:function(){if(this._explicitHeight){return this._explicitHeight;}return this._calculatedHeight;},setter:function(D){this._explicitHeight=D;return D;}},calculatedWidth:{getter:function(){return this._calculatedWidth;},setter:function(D){this._calculatedWidth=D;return D;}},calculatedHeight:{getter:function(){return this._calculatedHeight;},setter:function(D){this._calculatedHeight=D;return D;}},edgeOffset:{value:0},graphic:{},path:{readOnly:true,getter:function(){if(!this._path){var D=this.get("graphic");if(D){this._path=D.addShape({type:"path"});}}return this._path;}},tickPath:{readOnly:true,getter:function(){if(!this._tickPath){var D=this.get("graphic");if(D){this._tickPath=D.addShape({type:"path"});}}return this._tickPath;}},node:{},position:{setter:function(E){var D=this._layoutClasses[E];if(E&&E!="none"){this._layout=new D();}return E;}},topTickOffset:{value:0},bottomTickOffset:{value:0},leftTickOffset:{value:0},rightTickOffset:{value:0},labels:{readOnly:true,getter:function(){return this._labels;}},tickPoints:{readOnly:true,getter:function(){if(this.get("position")=="none"){return this.get("styles").majorUnit.count;}return this._tickPoints;}},overlapGraph:{value:true,validator:function(D){return q.isBoolean(D);}},labelFunctionScope:{},maxLabelSize:{getter:function(){return this._maxLabelSize;},setter:function(D){this._maxLabelSize=D;return D;}},title:{value:null},labelFunction:{value:function(E,D){return E;}},appendLabelFunction:{getter:function(){return this._setText;}},appendTitleFunction:{getter:function(){return this._setText;}}}});b.AxisType=b.Base.create("baseAxis",b.Axis,[],{initializer:function(){this.after("dataReady",b.bind(this._dataChangeHandler,this));this.after("dataUpdate",b.bind(this._dataChangeHandler,this));this.after("minimumChange",b.bind(this._keyChangeHandler,this));this.after("maximumChange",b.bind(this._keyChangeHandler,this));this.after("keysChange",this._keyChangeHandler);this.after("dataProviderChange",this._dataProviderChangeHandler);this.after("alwaysShowZeroChange",this._keyChangeHandler);this.after("roundingMethodChange",this._keyChangeHandler);},bindUI:function(){this.after("stylesChange",this._updateHandler);this.after("overlapGraphChange",this._updateHandler);this.after("positionChange",this._positionChangeHandler);this.after("widthChange",this._handleSizeChange);this.after("heightChange",this._handleSizeChange);this.after("calculatedWidthChange",this._handleSizeChange);this.after("calculatedHeightChange",this._handleSizeChange);},_dataProviderChangeHandler:function(G){var D=this.get("keyCollection").concat(),F=this.get("keys"),E;if(F){for(E in F){if(F.hasOwnProperty(E)){delete F[E];}}}if(D&&D.length){this.set("keys",D);}},GUID:"yuibaseaxis",_type:null,_setMaximum:null,_dataMaximum:null,_setMinimum:null,_data:null,_updateTotalDataFlag:true,_dataReady:false,addKey:function(D){this.set("keys",D);},_getKeyArray:function(G,H){var F=0,I,E=[],D=H.length;for(;F<D;++F){I=H[F];E[F]=I[G];}return E;},_setDataByKey:function(H,I){var G,J,E=[],F=this._dataClone.concat(),D=F.length;for(G=0;G<D;++G){J=F[G];E[G]=J[H];}this.get("keys")[H]=E;this._updateTotalDataFlag=true;},_updateTotalData:function(){var E=this.get("keys"),D;this._data=[];for(D in E){if(E.hasOwnProperty(D)){this._data=this._data.concat(E[D]);}}this._updateTotalDataFlag=false;},removeKey:function(E){var D=this.get("keys");if(D.hasOwnProperty(E)){delete D[E];this._keyChangeHandler();}},getKeyValueAt:function(E,D){var G=NaN,F=this.get("keys");if(F[E]&&q.isNumber(parseFloat(F[E][D]))){G=F[E][D];}return parseFloat(G);},getDataByKey:function(E){var D=this.get("keys");if(D[E]){return D[E];}return null;},_updateMinAndMax:function(){var I=this.get("data"),E=0,H=0,D,F,G;if(I&&I.length&&I.length>0){D=I.length;E=H=I[0];if(D>1){for(G=1;G<D;G++){F=I[G];if(isNaN(F)){continue;}E=Math.max(F,E);H=Math.min(F,H);}}}this._dataMaximum=E;this._dataMinimum=H;},getTotalMajorUnits:function(){var E,F=this.get("styles").majorUnit,D=this.get("length");if(F.determinant==="count"){E=F.count;}else{if(F.determinant==="distance"){E=(D/F.distance)+1;}}return E;},getMajorUnitDistance:function(D,G,E){var F;if(E.determinant==="count"){F=G/(D-1);}else{if(E.determinant==="distance"){F=E.distance;}}return F;},getEdgeOffset:function(E,D){return 0;},getLabelByIndex:function(H,E){var G=this.get("minimum"),D=this.get("maximum"),I=(D-G)/(E-1),F;E-=1;F=G+(H*I);return F;},_keyChangeHandler:function(D){this._updateMinAndMax();this.fire("dataUpdate");},_hasDataOverflow:function(){if(this.get("setMin")||this.get("setMax")){return true;
12 }return false;},getMinimumValue:function(){return this.get("minimum");},getMaximumValue:function(){return this.get("maximum");}},{ATTRS:{keys:{value:{},setter:function(H){var F={},E,D,G=this.get("dataProvider");if(q.isArray(H)){D=H.length;for(E=0;E<D;++E){F[H[E]]=this._getKeyArray(H[E],G);}}else{if(q.isString(H)){F=this.get("keys");F[H]=this._getKeyArray(H,G);}else{for(E in H){if(H.hasOwnProperty(E)){F[E]=this._getKeyArray(E,G);}}}}this._updateTotalDataFlag=true;return F;}},roundingMethod:{value:"niceNumber"},type:{readOnly:true,getter:function(){return this._type;}},dataProvider:{setter:function(D){return D;}},dataMaximum:{getter:function(){if(!this._dataMaximum){this._updateMinAndMax();}return this._dataMaximum;}},maximum:{lazyAdd:false,getter:function(){var D=this.get("dataMaximum"),E=this.get("minimum");if(E===0&&D===0){D=10;}if(q.isNumber(this._setMaximum)){D=this._setMaximum;}return parseFloat(D);},setter:function(D){this._setMaximum=parseFloat(D);return D;}},dataMinimum:{getter:function(){if(!this._dataMinimum){this._updateMinAndMax();}return this._dataMinimum;}},minimum:{lazyAdd:false,getter:function(){var D=this.get("dataMinimum");if(q.isNumber(this._setMinimum)){D=this._setMinimum;}return parseFloat(D);},setter:function(D){this._setMinimum=parseFloat(D);return D;}},setMax:{readOnly:true,getter:function(){return q.isNumber(this._setMaximum);}},setMin:{readOnly:true,getter:function(){return q.isNumber(this._setMinimum);}},data:{getter:function(){if(!this._data||this._updateTotalDataFlag){this._updateTotalData();}return this._data;}},keyCollection:{getter:function(){var F=this.get("keys"),E,D=[];for(E in F){if(F.hasOwnProperty(E)){D.push(E);}}return D;},readOnly:true}}});function l(D){l.superclass.constructor.apply(this,arguments);}l.NAME="numericAxis";l.ATTRS={alwaysShowZero:{value:true},labelFunction:{value:function(E,D){if(D){return b.DataType.Number.format(E,D);}return E;}},labelFormat:{value:{prefix:"",thousandsSeparator:"",decimalSeparator:"",decimalPlaces:"0",suffix:""}}};b.extend(l,b.AxisType,{formatLabel:function(E,D){if(D){return b.DataType.Number.format(E,D);}return E;},getTotalByKey:function(G){var H=0,E=this.getDataByKey(G),F=0,I,D=E?E.length:0;for(;F<D;++F){I=parseFloat(E[F]);if(!isNaN(I)){H+=I;}}return H;},_type:"numeric",_getMinimumUnit:function(D,F,E){return this._getNiceNumber(Math.ceil((D-F)/E));},_getNiceNumber:function(F){var H=F,D=Math.ceil(Math.log(H)*0.4342944819032518),G=Math.pow(10,D),E;if(G/2>=H){E=Math.floor((G/2-H)/(Math.pow(10,D-1)/2));H=G/2-E*Math.pow(10,D-1)/2;}else{H=G;}if(!isNaN(H)){return H;}return F;},_updateMinAndMax:function(){var E=this.get("data"),J,D,H,G,F=0,K,L=this.get("setMax"),I=this.get("setMin");if(!L||!I){if(E&&E.length&&E.length>0){H=E.length;for(;F<H;F++){G=E[F];if(isNaN(G)){if(q.isObject(G)){D=J=0;for(K in G){if(G.hasOwnProperty(K)){J=Math.max(G[K],J);D=Math.min(G[K],D);}}}J=L?this._setMaximum:J;D=I?this._setMinimum:D;continue;}if(I){D=this._setMinimum;}else{if(D===undefined){D=G;}else{D=Math.min(G,D);}}if(L){J=this._setMaximum;}else{if(J===undefined){J=G;}else{J=Math.max(G,J);}}this._actualMaximum=J;this._actualMinimum=D;}}this._roundMinAndMax(D,J,I,L);}},_roundMinAndMax:function(J,M,K,P){var E,V,S=J>=0,G=M>0,U,D,R,L,N,T,Q,I=this.getTotalMajorUnits()-1,O=this.get("alwaysShowZero"),F=this.get("roundingMethod"),H=(M-J)/I>=1;if(F){if(F=="niceNumber"){E=this._getMinimumUnit(M,J,I);if(S&&G){if((O||J<E)&&!K){J=0;E=this._getMinimumUnit(M,J,I);}else{J=this._roundDownToNearest(J,E);}if(P){if(!O){J=M-(E*I);}}else{if(K){M=J+(E*I);}else{M=this._roundUpToNearest(M,E);}}}else{if(G&&!S){if(O){L=Math.round(I/((-1*J)/M+1));L=Math.max(Math.min(L,I-1),1);N=I-L;T=Math.ceil(M/L);Q=Math.floor(J/N)*-1;if(K){while(Q<T&&N>=0){N--;L++;T=Math.ceil(M/L);Q=Math.floor(J/N)*-1;}if(N>0){M=Q*L;}else{M=J+(E*I);}}else{if(P){while(T<Q&&L>=0){N++;L--;Q=Math.floor(J/N)*-1;T=Math.ceil(M/L);}if(L>0){J=T*N*-1;}else{J=M-(E*I);}}else{E=Math.max(T,Q);E=this._getNiceNumber(E);M=E*L;J=E*N*-1;}}}else{if(P){J=M-(E*I);}else{if(K){M=J+(E*I);}else{J=this._roundDownToNearest(J,E);M=this._roundUpToNearest(M,E);}}}}else{if(K){if(O){M=0;}else{M=J+(E*I);}}else{if(!P){if(O||M===0||M+E>0){M=0;E=this._getMinimumUnit(M,J,I);J=M-(E*I);}else{J=this._roundDownToNearest(J,E);M=this._roundUpToNearest(M,E);}}else{J=M-(E*I);}}}}}else{if(F=="auto"){if(S&&G){if((O||J<(M-J)/I)&&!K){J=0;}E=(M-J)/I;if(H){E=Math.ceil(E);}M=J+(E*I);}else{if(G&&!S){if(O){L=Math.round(I/((-1*J)/M+1));L=Math.max(Math.min(L,I-1),1);N=I-L;if(H){T=Math.ceil(M/L);Q=Math.floor(J/N)*-1;}else{T=M/L;Q=J/N*-1;}E=Math.max(T,Q);M=E*L;J=E*N*-1;}else{E=(M-J)/I;if(H){E=Math.ceil(E);}J=this._roundDownToNearest(J,E);M=this._roundUpToNearest(M,E);}}else{E=(M-J)/I;if(H){E=Math.ceil(E);}if(O||M===0||M+E>0){M=0;E=(M-J)/I;if(H){Math.ceil(E);}J=M-(E*I);}else{J=this._roundDownToNearest(J,E);M=this._roundUpToNearest(M,E);}}}}else{if(!isNaN(F)&&isFinite(F)){E=F;V=E*I;U=(M-J)>V;R=this._roundDownToNearest(J,E);D=this._roundUpToNearest(M,E);if(P){J=M-V;}else{if(K){M=J+V;}else{if(S&&G){if(O||R<=0){J=0;}else{J=R;}M=J+V;}else{if(G&&!S){J=R;M=D;}else{if(O||D>=0){M=0;}else{M=D;}J=M-V;}}}}}}}}this._dataMaximum=M;this._dataMinimum=J;},getLabelByIndex:function(H,E){var G=this.get("minimum"),D=this.get("maximum"),J=(D-G)/(E-1),F,I=this.get("roundingMethod");E-=1;if(H===0){F=G;}else{if(H===E){F=D;}else{F=(H*J);if(I=="niceNumber"){F=this._roundToNearest(F,J);}F+=G;}}return parseFloat(F);},_roundToNearest:function(F,E){E=E||1;if(E===0){return F;}var D=Math.round(this._roundToPrecision(F/E,10))*E;return this._roundToPrecision(D,10);},_roundUpToNearest:function(E,D){D=D||1;if(D===0){return E;}return Math.ceil(this._roundToPrecision(E/D,10))*D;},_roundDownToNearest:function(E,D){D=D||1;if(D===0){return E;}return Math.floor(this._roundToPrecision(E/D,10))*D;},_roundToPrecision:function(F,D){D=D||0;var E=Math.pow(10,D);return Math.round(E*F)/E;},_hasDataOverflow:function(){var F,E,D;if(this.get("setMin")||this.get("setMax")){return true;}F=this.get("roundingMethod");
13 E=this._actualMinimum;D=this._actualMaximum;if(q.isNumber(F)&&((q.isNumber(D)&&D>this._dataMaximum)||(q.isNumber(E)&&E<this._dataMinimum))){return true;}return false;}});b.NumericAxis=l;function e(D){e.superclass.constructor.apply(this,arguments);}e.NAME="stackedAxis";b.extend(e,b.NumericAxis,{_updateMinAndMax:function(){var K=0,E=0,J=0,D=0,H=0,F=0,L,G,M=this.get("keys"),I=this.get("setMin"),N=this.get("setMax");for(L in M){if(M.hasOwnProperty(L)){H=Math.max(H,M[L].length);}}for(;F<H;++F){J=0;D=0;for(L in M){if(M.hasOwnProperty(L)){G=M[L][F];if(isNaN(G)){continue;}if(G>=0){J+=G;}else{D+=G;}}}if(J>0){K=Math.max(K,J);}else{K=Math.max(K,D);}if(D<0){E=Math.min(E,D);}else{E=Math.min(E,J);}}this._actualMaximum=K;this._actualMinimum=E;if(N){K=this._setMaximum;}if(I){E=this._setMinimum;}this._roundMinAndMax(E,K,I,N);}});b.StackedAxis=e;function d(D){d.superclass.constructor.apply(this,arguments);}d.NAME="timeAxis";d.ATTRS={setMax:{readOnly:true,getter:function(){var D=this._getNumber(this._setMaximum);return(q.isNumber(D));}},setMin:{readOnly:true,getter:function(){var D=this._getNumber(this._setMinimum);return(q.isNumber(D));}},maximum:{getter:function(){var D=this._getNumber(this._setMaximum);if(!q.isNumber(D)){D=this._getNumber(this.get("dataMaximum"));}return parseFloat(D);},setter:function(D){this._setMaximum=this._getNumber(D);return D;}},minimum:{getter:function(){var D=this._getNumber(this._setMinimum);if(!q.isNumber(D)){D=this._getNumber(this.get("dataMinimum"));}return parseFloat(D);},setter:function(D){this._setMinimum=this._getNumber(D);return D;}},labelFunction:{value:function(E,D){E=b.DataType.Date.parse(E);if(D){return b.DataType.Date.format(E,{format:D});}return E;}},labelFormat:{value:"%b %d, %y"}};b.extend(d,b.AxisType,{formatLabel:function(E,D){E=b.DataType.Date.parse(E);if(D){return b.DataType.Date.format(E,{format:D});}return E;},GUID:"yuitimeaxis",_dataType:"time",getLabelByIndex:function(I,F){var H=this.get("minimum"),E=this.get("maximum"),D=this.get("position"),J,G;F-=1;J=((E-H)/F)*I;if(D=="bottom"||D=="top"){G=H+J;}else{G=E-J;}return G;},_getKeyArray:function(G,H){var I,E=[],F=0,J,D=H.length;for(;F<D;++F){I=H[F][G];if(q.isDate(I)){J=I.valueOf();}else{J=new Date(I);if(q.isDate(J)){J=J.valueOf();}else{if(!q.isNumber(I)){if(q.isNumber(parseFloat(I))){J=parseFloat(I);}else{if(typeof I!="string"){I=I;}J=new Date(I).valueOf();}}else{J=I;}}}E[F]=J;}return E;},_setDataByKey:function(H,I){var J,E=[],G=this._dataClone.concat(),F,K,D=G.length;for(F=0;F<D;++F){J=G[F][H];if(q.isDate(J)){K=J.valueOf();}else{K=new Date(J);if(q.isDate(K)){K=K.valueOf();}else{if(!q.isNumber(J)){if(q.isNumber(parseFloat(J))){K=parseFloat(J);}else{if(typeof J!="string"){J=J.toString();}K=new Date(J).valueOf();}}else{K=J;}}}E[F]=K;}this.get("keys")[H]=E;this._updateTotalDataFlag=true;},_getNumber:function(D){if(q.isDate(D)){D=D.valueOf();}else{if(!q.isNumber(D)&&D){D=new Date(D).valueOf();}}return D;}});b.TimeAxis=d;function f(D){f.superclass.constructor.apply(this,arguments);}f.NAME="categoryAxis";b.extend(f,b.AxisType,{formatLabel:function(E,D){return E;},_indices:null,GUID:"yuicategoryaxis",_type:"category",_updateMinAndMax:function(){this._dataMaximum=Math.max(this.get("data").length-1,0);this._dataMinimum=0;},_getKeyArray:function(G,H){var F=0,I,E=[],J=[],D=H.length;if(!this._indices){this._indices={};}for(;F<D;++F){I=H[F];E[F]=F;J[F]=I[G];}this._indices[G]=E;return J;},_setDataByKey:function(H){var G,I,E=[],J=[],F=this._dataClone.concat(),D=F.length;if(!this._indices){this._indices={};}for(G=0;G<D;++G){I=F[G];E[G]=G;J[G]=I[H];}this._indices[H]=E;this.get("keys")[H]=J.concat();this._updateTotalDataFlag=true;},getDataByKey:function(E){if(!this._indices){this.get("keys");}var D=this._indices;if(D[E]){return D[E];}return null;},getTotalMajorUnits:function(E,D){return this.get("data").length;},getMajorUnitDistance:function(D,G,E){var F;if(E.determinant==="count"){F=G/D;}else{if(E.determinant==="distance"){F=E.distance;}}return F;},getEdgeOffset:function(E,D){return D/E;},getKeyValueAt:function(E,D){var G=NaN,F=this.get("keys");if(F[E]&&F[E][D]){G=F[E][D];}return G;},getLabelByIndex:function(G,E){var F,H=this.get("data"),D=this.get("position");if(D=="bottom"||D=="top"){F=H[G];}else{F=H[E-(G+1)];}return F;},getMinimumValue:function(){var E=this.get("data"),D=E[0];return D;},getMaximumValue:function(){var F=this.get("data"),D=F.length-1,E=F[D];return E;}});b.CategoryAxis=f;function j(){}j.prototype={getCurveControlPoints:function(G,J){var H=[],F=1,E=G.length-1,D=[],I=[];if(E<1){return null;}H[0]={startx:G[0],starty:J[0],endx:G[1],endy:J[1]};if(E===1){H[0].ctrlx1=(2*G[0]+G[1])/3;H[0].ctrly2=(2*J[0]+J[1])/3;H[0].ctrlx2=2*H[0].ctrlx1-G[0];H[0].ctrly2=2*H[0].ctrly1-J[0];return H;}for(;F<E;++F){H.push({startx:Math.round(G[F]),starty:Math.round(J[F]),endx:Math.round(G[F+1]),endy:Math.round(J[F+1])});D[F]=4*G[F]+2*G[F+1];I[F]=4*J[F]+2*J[F+1];}D[0]=G[0]+(2*G[1]);D[E-1]=(8*G[E-1]+G[E])/2;D=this.getControlPoints(D.concat());I[0]=J[0]+(2*J[1]);I[E-1]=(8*J[E-1]+J[E])/2;I=this.getControlPoints(I.concat());for(F=0;F<E;++F){H[F].ctrlx1=Math.round(D[F]);H[F].ctrly1=Math.round(I[F]);if(F<E-1){H[F].ctrlx2=Math.round(2*G[F+1]-D[F+1]);H[F].ctrly2=Math.round(2*J[F+1]-I[F+1]);}else{H[F].ctrlx2=Math.round((G[E]+D[E-1])/2);H[F].ctrly2=Math.round((J[E]+I[E-1])/2);}}return H;},getControlPoints:function(I){var F=I.length,E=[],H=[],D=2,G=1;E[0]=I[0]/D;for(;G<F;++G){H[G]=1/D;D=(G<F-1?4:3.5)-H[G];E[G]=(I[G]-E[G-1])/D;}for(G=1;G<F;++G){E[F-G-1]-=H[F-G]*E[F-G];}return E;}};b.CurveUtil=j;function i(){}i.prototype={_stackCoordinates:function(){var N=this.get("direction"),F=this.get("order"),L=this.get("type"),O=this.get("graph"),I=O.get("height"),E=O.seriesTypes[L],H=0,K,M=this.get("xcoords"),G=this.get("ycoords"),J,D;if(F===0){return;}J=E[F-1].get("xcoords").concat();D=E[F-1].get("ycoords").concat();if(N==="vertical"){K=J.length;for(;H<K;++H){if(!isNaN(J[H])&&!isNaN(M[H])){M[H]+=J[H];}}}else{K=D.length;for(;H<K;++H){if(!isNaN(D[H])&&!isNaN(G[H])){G[H]=D[H]-(I-G[H]);
14 }}}}};b.StackingUtil=i;function h(){}h.prototype={_lineDefaults:null,_getGraphic:function(){var D=this.get("graphic")||this.get("graph").get("graphic");if(!this._lineGraphic){this._lineGraphic=D.addShape({type:"path"});}this._lineGraphic.clear();return this._lineGraphic;},_toggleVisible:function(D){if(this._lineGraphic){this._lineGraphic.set("visible",D);}},drawLines:function(){if(this.get("xcoords").length<1){return;}var K=q.isNumber,L=this.get("xcoords").concat(),aa=this.get("ycoords").concat(),W=this.get("direction"),R=W==="vertical"?aa.length:L.length,Y,D,G=true,Z,X,V,S,Q,H=this.get("styles").line,T=H.lineType,O=H.color||this._getDefaultColor(this.get("graphOrder"),"line"),M=H.alpha,U=H.dashLength,J=H.gapSpace,I=H.connectDiscontinuousPoints,E=H.discontinuousType,F=H.discontinuousDashLength,P=H.discontinuousGapSpace,N=this._getGraphic();N.set("stroke",{weight:H.weight,color:O,opacity:M});for(Q=0;Q<R;Q=++Q){V=L[Q];S=aa[Q];D=K(V)&&K(S);if(!D){Y=D;continue;}if(G){G=false;N.moveTo(V,S);}else{if(Y){if(T!="dashed"){N.lineTo(V,S);}else{this.drawDashedLine(N,Z,X,V,S,U,J);}}else{if(!I){N.moveTo(V,S);}else{if(E!="solid"){this.drawDashedLine(N,Z,X,V,S,F,P);}else{N.lineTo(V,S);}}}}Z=V;X=S;Y=true;}N.end();},drawSpline:function(){if(this.get("xcoords").length<1){return;}var N=this.get("xcoords"),H=this.get("ycoords"),P=this.getCurveControlPoints(N,H),I=P.length,K,J,E,D,O,M,G=0,Q=this.get("styles").line,R=this._getGraphic(),L=Q.alpha,F=Q.color||this._getDefaultColor(this.get("graphOrder"),"line");R.set("stroke",{weight:Q.weight,color:F,opacity:L});R.moveTo(N[0],H[0]);for(;G<I;G=++G){O=P[G].endx;M=P[G].endy;K=P[G].ctrlx1;J=P[G].ctrlx2;E=P[G].ctrly1;D=P[G].ctrly2;R.curveTo(K,E,J,D,O,M);}R.end();},drawDashedLine:function(R,N,S,D,P,F,E){F=F||10;E=E||10;var H=F+E,K=D-N,O=P-S,Q=Math.sqrt(Math.pow(K,2)+Math.pow(O,2)),I=Math.floor(Math.abs(Q/H)),G=Math.atan2(O,K),M=N,L=S,J;K=Math.cos(G)*H;O=Math.sin(G)*H;for(J=0;J<I;++J){R.moveTo(M,L);R.lineTo(M+Math.cos(G)*F,L+Math.sin(G)*F);M+=K;L+=O;}R.moveTo(M,L);Q=Math.sqrt((D-M)*(D-M)+(P-L)*(P-L));if(Q>F){R.lineTo(M+Math.cos(G)*F,L+Math.sin(G)*F);}else{if(Q>0){R.lineTo(M+Math.cos(G)*Q,L+Math.sin(G)*Q);}}R.moveTo(D,P);},_getLineDefaults:function(){return{alpha:1,weight:6,lineType:"solid",dashLength:10,gapSpace:10,connectDiscontinuousPoints:true,discontinuousType:"solid",discontinuousDashLength:10,discontinuousGapSpace:10};}};b.augment(h,b.Attribute);b.Lines=h;function y(D){var E={area:{getter:function(){return this._defaults||this._getAreaDefaults();},setter:function(G){var F=this._defaults||this._getAreaDefaults();this._defaults=b.merge(F,G);}}};this.addAttrs(E,D);this.get("styles");}y.prototype={_getPath:function(){var D=this._path;if(!D){D=this.get("graph").get("graphic").addShape({type:"path"});this._path=D;}return D;},_toggleVisible:function(D){if(this._path){this._path.set("visible",D);}},drawFill:function(L,H){if(L.length<1){return;}var K=L.length,E=L[0],D=H[0],J=E,I=D,P,N,G=1,M=this.get("styles").area,O=this._getPath(),F=M.color||this._getDefaultColor(this.get("graphOrder"),"slice");O.clear();O.set("fill",{color:F,opacity:M.alpha});O.set("stroke",{weight:0});O.moveTo(E,D);for(;G<K;G=++G){P=L[G];N=H[G];if(isNaN(N)){J=P;I=N;continue;}O.lineTo(P,N);J=P;I=N;}O.end();},drawAreaSpline:function(){if(this.get("xcoords").length<1){return;}var O=this.get("xcoords"),J=this.get("ycoords"),Q=this.getCurveControlPoints(O,J),K=Q.length,M,L,G,F,P,N,I=0,E=O[0],D=J[0],R=this.get("styles").area,S=this._getPath(),H=R.color||this._getDefaultColor(this.get("graphOrder"),"slice");S.set("fill",{color:H,opacity:R.alpha});S.set("stroke",{weight:0});S.moveTo(E,D);for(;I<K;I=++I){P=Q[I].endx;N=Q[I].endy;M=Q[I].ctrlx1;L=Q[I].ctrlx2;G=Q[I].ctrly1;F=Q[I].ctrly2;S.curveTo(M,G,L,F,P,N);}if(this.get("direction")==="vertical"){S.lineTo(this._leftOrigin,N);S.lineTo(this._leftOrigin,D);}else{S.lineTo(P,this._bottomOrigin);S.lineTo(E,this._bottomOrigin);}S.lineTo(E,D);S.end();},drawStackedAreaSpline:function(){if(this.get("xcoords").length<1){return;}var N=this.get("xcoords"),Y=this.get("ycoords"),M,T=this.get("order"),F=this.get("type"),D=this.get("graph"),G=D.seriesTypes[F],E,Q,V,P,O,X,W,K,I,U=0,L,J,H=this.get("styles").area,R=this._getPath(),S=H.color||this._getDefaultColor(this.get("graphOrder"),"slice");L=N[0];J=Y[0];M=this.getCurveControlPoints(N,Y);V=M.length;R.set("fill",{color:S,opacity:H.alpha});R.set("stroke",{weight:0});R.moveTo(L,J);for(;U<V;U=++U){K=M[U].endx;I=M[U].endy;P=M[U].ctrlx1;O=M[U].ctrlx2;X=M[U].ctrly1;W=M[U].ctrly2;R.curveTo(P,X,O,W,K,I);}if(T>0){E=G[T-1].get("xcoords").concat().reverse();Q=G[T-1].get("ycoords").concat().reverse();M=this.getCurveControlPoints(E,Q);U=0;V=M.length;R.lineTo(E[0],Q[0]);for(;U<V;U=++U){K=M[U].endx;I=M[U].endy;P=M[U].ctrlx1;O=M[U].ctrlx2;X=M[U].ctrly1;W=M[U].ctrly2;R.curveTo(P,X,O,W,K,I);}}else{if(this.get("direction")==="vertical"){R.lineTo(this._leftOrigin,Y[Y.length-1]);R.lineTo(this._leftOrigin,J);}else{R.lineTo(N[N.length-1],this._bottomOrigin);R.lineTo(L,this._bottomOrigin);}}R.lineTo(L,J);R.end();},_defaults:null,_getClosingPoints:function(){var D=this.get("xcoords").concat(),E=this.get("ycoords").concat();if(this.get("direction")==="vertical"){D.push(this._leftOrigin);D.push(this._leftOrigin);E.push(E[E.length-1]);E.push(E[0]);}else{D.push(D[D.length-1]);D.push(D[0]);E.push(this._bottomOrigin);E.push(this._bottomOrigin);}D.push(D[0]);E.push(E[0]);return[D,E];},_getStackedClosingPoints:function(){var H=this.get("order"),K=this.get("type"),N=this.get("graph"),L=this.get("direction"),F=N.seriesTypes[K],J,G,M=this.get("xcoords").concat(),I=this.get("ycoords").concat(),E=M[0],D=I[0];if(H>0){J=F[H-1].get("xcoords").concat();G=F[H-1].get("ycoords").concat();M=M.concat(J.concat().reverse());I=I.concat(G.concat().reverse());M.push(M[0]);I.push(I[0]);}else{if(L==="vertical"){M.push(this._leftOrigin);M.push(this._leftOrigin);I.push(I[I.length-1]);I.push(D);}else{M.push(M[M.length-1]);M.push(E);I.push(this._bottomOrigin);I.push(this._bottomOrigin);}}return[M,I];
15 },_getAreaDefaults:function(){return{};}};b.augment(y,b.Attribute);b.Fills=y;function x(D){var E={markers:{getter:function(){return this._markers;}}};this.addAttrs(E,D);}x.prototype={_plotDefaults:null,drawPlots:function(){if(!this.get("xcoords")||this.get("xcoords").length<1){return;}var N=q.isNumber,U=b.clone(this.get("styles").marker),M=U.width,T=U.height,O=this.get("xcoords"),V=this.get("ycoords"),R=0,S=O.length,P=V[0],G,J,Q=M/2,F=T/2,K,H,E=null,I=null,L=this.get("graphOrder"),D=this.get("groupMarkers");if(D){K=[];H=[];for(;R<S;++R){K.push(parseFloat(O[R]-Q));H.push(parseFloat(V[R]-F));}this._createGroupMarker({xvalues:K,yvalues:H,fill:U.fill,border:U.border,dimensions:{width:M,height:T},graphOrder:L,shape:U.shape});return;}if(q.isArray(U.fill.color)){E=U.fill.color.concat();}if(q.isArray(U.border.color)){I=U.border.color.concat();}this._createMarkerCache();for(;R<S;++R){P=parseFloat(V[R]-F);G=parseFloat(O[R]-Q);if(!N(G)||!N(P)){this._markers.push(null);continue;}if(E){U.fill.color=E[R%E.length];}if(I){U.border.color=I[R%I.length];}U.x=G;U.y=P;J=this.getMarker(U,L,R);}this._clearMarkerCache();},_groupShapes:{circle:b.CircleGroup,rect:b.RectGroup,ellipse:b.EllipseGroup,diamond:b.DiamondGroup},_getGroupShape:function(D){if(q.isString(D)){D=this._groupShapes[D];}return D;},_getPlotDefaults:function(){var D={fill:{type:"solid",alpha:1,colors:null,alphas:null,ratios:null},border:{weight:1,alpha:1},width:10,height:10,shape:"circle"};D.fill.color=this._getDefaultColor(this.get("graphOrder"),"fill");D.border.color=this._getDefaultColor(this.get("graphOrder"),"border");return D;},_markers:null,_markerCache:null,getMarker:function(H,D,G){var E,F=H.border;H.id=this.get("chart").get("id")+"_"+D+"_"+G;F.opacity=F.alpha;H.stroke=F;H.fill.opacity=H.fill.alpha;if(this._markerCache.length>0){while(!E){if(this._markerCache.length<1){E=this._createMarker(H,D,G);break;}E=this._markerCache.shift();}E.set(H);}else{E=this._createMarker(H,D,G);}this._markers.push(E);return E;},_createMarker:function(H,D,G){var I=this.get("graphic"),F,E=b.clone(H);I.set("autoDraw",false);E.type=E.shape;F=I.addShape(E);F.addClass(n);return F;},_createMarkerCache:function(){if(this._groupMarker){this._groupMarker.destroy();this._groupMarker=null;}if(this._markers&&this._markers.length>0){this._markerCache=this._markers.concat();}else{this._markerCache=[];}this._markers=[];},_createGroupMarker:function(H){var E,I=this.get("markers"),G=H.border,J,D,F;if(I&&I.length>0){while(I.length>0){E=I.shift();E.destroy();}this.set("markers",[]);}G.opacity=G.alpha;D={id:this.get("chart").get("id")+"_"+H.graphOrder,stroke:G,fill:H.fill,dimensions:H.dimensions,xvalues:H.xvalues,yvalues:H.yvalues};D.fill.opacity=H.fill.alpha;F=this._getGroupShape(H.shape);if(F){D.type=F;}if(H.hasOwnProperty("radius")&&!isNaN(H.radius)){D.dimensions.radius=H.radius;}if(this._groupMarker){this._groupMarker.destroy();}J=this.get("graphic");J.set("autoDraw",true);this._groupMarker=J.addShape(D);},_toggleVisible:function(H){var E,G=this.get("markers"),F=0,D;if(G){D=G.length;for(;F<D;++F){E=G[F];if(E){E.set("visible",H);}}}},_clearMarkerCache:function(){var D;while(this._markerCache.length>0){D=this._markerCache.shift();if(D){D.destroy();}}},updateMarkerState:function(J,H){if(this._markers&&this._markers[H]){var L,I,M=b.clone(this.get("styles").marker),D=this._getState(J),K=this.get("xcoords"),G=this.get("ycoords"),F=this._markers[H],E=D=="off"||!M[D]?M:M[D];E.fill.color=this._getItemColor(E.fill.color,H);E.border.color=this._getItemColor(E.border.color,H);E.stroke=E.border;F.set(E);L=E.width;I=E.height;F.set("x",(K[H]-L/2));F.set("y",(G[H]-I/2));F.set("visible",this.get("visible"));}},_getItemColor:function(E,D){if(q.isArray(E)){return E[D%E.length];}return E;},_setStyles:function(D){D=this._parseMarkerStyles(D);return b.Renderer.prototype._setStyles.apply(this,[D]);},_parseMarkerStyles:function(E){if(E.marker){var D=this._getPlotDefaults();E.marker=this._mergeStyles(E.marker,D);if(E.marker.over){E.marker.over=this._mergeStyles(E.marker.over,E.marker);}if(E.marker.down){E.marker.down=this._mergeStyles(E.marker.down,E.marker);}}return E;},_getState:function(D){var E;switch(D){case"mouseout":E="off";break;case"mouseover":E="over";break;case"mouseup":E="over";break;case"mousedown":E="down";break;}return E;},_stateSyles:null};b.augment(x,b.Attribute);b.Plots=x;function B(){}B.prototype={drawSeries:function(){if(this.get("xcoords").length<1){return;}var af=b.clone(this.get("styles").marker),V,R,N=this.get("xcoords"),O=this.get("ycoords"),ag=0,K=N.length,G=O[0],am=this.get("type"),aa=this.get("graph"),Y=aa.seriesTypes[am],E=Y.length,ad=0,ai=0,ab=0,ac,T,U=this.get("order"),ak=this.get("graphOrder"),F,al,P,Q,W,ah=null,D=null,X=[],H=[],L,M,S,aj,Z={width:[],height:[]},J=[],I=[],ae=this.get("groupMarkers");if(q.isArray(af.fill.color)){ah=af.fill.color.concat();}if(q.isArray(af.border.color)){D=af.border.color.concat();}if(this.get("direction")=="vertical"){P="height";Q="width";}else{P="width";Q="height";}V=af[P];R=af[Q];this._createMarkerCache();for(;ag<E;++ag){T=Y[ag];ad+=T.get("styles").marker[P];if(U>ag){ab=ad;}}ai=K*ad;this._maxSize=aa.get(P);if(ai>this._maxSize){ac=aa.get(P)/ai;ad*=ac;ab*=ac;V*=ac;V=Math.max(V,1);this._maxSize=V;}ab-=ad/2;for(ag=0;ag<K;++ag){L=N[ag]-ad/2;M=L+ad;S=O[ag]-ad/2;aj=S+ad;X.push({start:L,end:M});H.push({start:S,end:aj});if(isNaN(N[ag])||isNaN(O[ag])){this._markers.push(null);continue;}W=this._getMarkerDimensions(N[ag],O[ag],R,ab);if(!isNaN(W.calculatedSize)&&W.calculatedSize>0){G=W.top;F=W.left;if(ae){Z[P][ag]=V;Z[Q][ag]=W.calculatedSize;J.push(F);I.push(G);}else{af[P]=V;af[Q]=W.calculatedSize;af.x=F;af.y=G;if(ah){af.fill.color=ah[ag%ah.length];}if(D){af.border.color=D[ag%D.length];}al=this.getMarker(af,ak,ag);}}else{if(!ae){this._markers.push(null);}}}this.set("xMarkerPlane",X);this.set("yMarkerPlane",H);if(ae){this._createGroupMarker({fill:af.fill,border:af.border,dimensions:Z,xvalues:J,yvalues:I,shape:af.shape});}else{this._clearMarkerCache();
16 }},_defaultFillColors:["#66007f","#a86f41","#295454","#996ab2","#e8cdb7","#90bdbd","#000000","#c3b8ca","#968373","#678585"],_getPlotDefaults:function(){var D={fill:{type:"solid",alpha:1,colors:null,alphas:null,ratios:null},border:{weight:0,alpha:1},width:12,height:12,shape:"rect",padding:{top:0,left:0,right:0,bottom:0}};D.fill.color=this._getDefaultColor(this.get("graphOrder"),"fill");D.border.color=this._getDefaultColor(this.get("graphOrder"),"border");return D;}};b.Histogram=B;b.CartesianSeries=b.Base.create("cartesianSeries",b.Base,[b.Renderer],{_xDisplayName:null,_yDisplayName:null,_leftOrigin:null,_bottomOrigin:null,render:function(){this._setCanvas();this.addListeners();this.set("rendered",true);this.validate();},addListeners:function(){var E=this.get("xAxis"),D=this.get("yAxis");if(E){E.after("dataReady",b.bind(this._xDataChangeHandler,this));E.after("dataUpdate",b.bind(this._xDataChangeHandler,this));}if(D){D.after("dataReady",b.bind(this._yDataChangeHandler,this));D.after("dataUpdate",b.bind(this._yDataChangeHandler,this));}this.after("xAxisChange",this._xAxisChangeHandler);this.after("yAxisChange",this._yAxisChangeHandler);this.after("stylesChange",function(G){var F=this._updateAxisData();if(F){this.draw();}});this.after("widthChange",function(G){var F=this._updateAxisData();if(F){this.draw();}});this.after("heightChange",function(G){var F=this._updateAxisData();if(F){this.draw();}});this.after("visibleChange",this._handleVisibleChange);},_xAxisChangeHandler:function(E){var D=this.get("xAxis");D.after("dataReady",b.bind(this._xDataChangeHandler,this));D.after("dataUpdate",b.bind(this._xDataChangeHandler,this));},_yAxisChangeHandler:function(E){var D=this.get("yAxis");D.after("dataReady",b.bind(this._yDataChangeHandler,this));D.after("dataUpdate",b.bind(this._yDataChangeHandler,this));},GUID:"yuicartesianseries",_xDataChangeHandler:function(D){var E=this._updateAxisData();if(E){this.draw();}},_yDataChangeHandler:function(D){var E=this._updateAxisData();if(E){this.draw();}},_updateAxisData:function(){var H=this.get("xAxis"),E=this.get("yAxis"),F=this.get("xKey"),D=this.get("yKey"),G,I;if(!H||!E||!F||!D){return false;}I=H.getDataByKey(F);G=E.getDataByKey(D);if(!I||!G){return false;}this.set("xData",I.concat());this.set("yData",G.concat());return true;},validate:function(){if((this.get("xData")&&this.get("yData"))||this._updateAxisData()){this.draw();}else{this.fire("drawingComplete");}},_setCanvas:function(){var D=this.get("graph"),E=D.get("graphic");this.set("graphic",E);},setAreaData:function(){var U=q.isNumber,ai,ag,H=this.get("graph"),Q=H.get("width"),ab=H.get("height"),O=this.get("xAxis"),E=this.get("yAxis"),J=this.get("xData").concat(),ae=this.get("yData").concat(),Y,ac,al=O.getEdgeOffset(J.length,Q),N=E.getEdgeOffset(ae.length,ab),V=this.get("styles").padding,X=V.left,af=V.top,L=Q-(X+V.right+al),aa=ab-(af+V.bottom+N),T=[],ak=[],aj=O.get("maximum"),ad=O.get("minimum"),G=E.get("maximum"),D=E.get("minimum"),K=L/(aj-ad),R=aa/(G-D),M,ah=this.get("direction"),Z=0,P=[],W=[],I=this.get("xMarkerPlaneOffset"),F=this.get("yMarkerPlaneOffset"),S=this.get("graphic");S.set("width",Q);S.set("height",ab);M=J.length;al*=0.5;N*=0.5;if(ah==="vertical"){ae=ae.reverse();}this._leftOrigin=Math.round(((0-ad)*K)+X+al);this._bottomOrigin=Math.round((aa+af+N));for(;Z<M;++Z){Y=parseFloat(J[Z]);ac=parseFloat(ae[Z]);if(U(Y)){ai=Math.round((((Y-ad)*K)+X+al));}else{ai=NaN;}if(U(ac)){ag=Math.round(((aa+af+N)-(ac-D)*R));}else{ag=NaN;}T.push(ai);ak.push(ag);P.push({start:ai-I,end:ai+I});W.push({start:ag-F,end:ag+F});}this.set("xcoords",T);this.set("ycoords",ak);this.set("xMarkerPlane",P);this.set("yMarkerPlane",W);this._dataLength=M;},draw:function(){var F=this.get("graph"),D=F.get("width"),E=F.get("height");if(this.get("rendered")){if((isFinite(D)&&isFinite(E)&&D>0&&E>0)&&((this.get("xData")&&this.get("yData"))||this._updateAxisData())){if(this._drawing){this._callLater=true;return;}this._drawing=true;this._callLater=false;this.setAreaData();if(this.get("xcoords")&&this.get("ycoords")){this.drawSeries();}this._drawing=false;if(this._callLater){this.draw();}else{this._toggleVisible(this.get("visible"));this.fire("drawingComplete");}}}},_defaultPlaneOffset:4,_getDefaultStyles:function(){return{padding:{top:0,left:0,right:0,bottom:0}};},_defaultLineColors:["#426ab3","#d09b2c","#000000","#b82837","#b384b5","#ff7200","#779de3","#cbc8ba","#7ed7a6","#007a6c"],_defaultFillColors:["#6084d0","#eeb647","#6c6b5f","#d6484f","#ce9ed1","#ff9f3b","#93b7ff","#e0ddd0","#94ecba","#309687"],_defaultBorderColors:["#205096","#b38206","#000000","#94001e","#9d6fa0","#e55b00","#5e85c9","#adab9e","#6ac291","#006457"],_defaultSliceColors:["#66007f","#a86f41","#295454","#996ab2","#e8cdb7","#90bdbd","#000000","#c3b8ca","#968373","#678585"],_getDefaultColor:function(G,H){var E={line:this._defaultLineColors,fill:this._defaultFillColors,border:this._defaultBorderColors,slice:this._defaultSliceColors},F=E[H],D=F.length;G=G||0;if(G>=D){G=G%D;}H=H||"fill";return E[H][G];},_handleVisibleChange:function(D){this._toggleVisible(this.get("visible"));},getTotalValues:function(){var D=this.get("valueAxis").getTotalByKey(this.get("valueKey"));return D;},destructor:function(){if(this._path){this._path.destroy();}if(this._lineGraphic){this._lineGraphic.destroy();this._lineGraphic=null;}if(this.get("graphic")){this.get("graphic").destroy();}}},{ATTRS:{xDisplayName:{getter:function(){return this._xDisplayName||this.get("xKey");},setter:function(D){this._xDisplayName=D.toString();return D;}},yDisplayName:{getter:function(){return this._yDisplayName||this.get("yKey");},setter:function(D){this._yDisplayName=D.toString();return D;}},categoryDisplayName:{readOnly:true,getter:function(){return this.get("direction")=="vertical"?this.get("yDisplayName"):this.get("xDisplayName");}},valueDisplayName:{readOnly:true,getter:function(){return this.get("direction")=="vertical"?this.get("xDisplayName"):this.get("yDisplayName");}},type:{value:"cartesian"},order:{},graphOrder:{},xcoords:{},ycoords:{},chart:{readOnly:true,getter:function(){return this.get("graph").get("chart");
17 }},graph:{},xAxis:{},yAxis:{},xKey:{setter:function(D){return D.toString();}},yKey:{setter:function(D){return D.toString();}},xData:{},yData:{},rendered:{value:false},width:{readOnly:true,getter:function(){this.get("graph").get("width");}},height:{readOnly:true,getter:function(){this.get("graph").get("height");}},visible:{value:true},xMarkerPlane:{},yMarkerPlane:{},xMarkerPlaneOffset:{getter:function(){var D=this.get("styles").marker;if(D&&D.width&&isFinite(D.width)){return D.width*0.5;}return this._defaultPlaneOffset;}},yMarkerPlaneOffset:{getter:function(){var D=this.get("styles").marker;if(D&&D.height&&isFinite(D.height)){return D.height*0.5;}return this._defaultPlaneOffset;}},direction:{value:"horizontal"},groupMarkers:{getter:function(){if(this._groupMarkers===undefined){return this.get("graph").get("groupMarkers");}else{return this._groupMarkers;}},setter:function(D){this._groupMarkers=D;return D;}}}});b.MarkerSeries=b.Base.create("markerSeries",b.CartesianSeries,[b.Plots],{drawSeries:function(){this.drawPlots();},_setStyles:function(D){if(!D.marker){D={marker:D};}D=this._parseMarkerStyles(D);return b.MarkerSeries.superclass._mergeStyles.apply(this,[D,this._getDefaultStyles()]);},_getDefaultStyles:function(){var D=this._mergeStyles({marker:this._getPlotDefaults()},b.MarkerSeries.superclass._getDefaultStyles());return D;}},{ATTRS:{type:{value:"marker"}}});b.LineSeries=b.Base.create("lineSeries",b.CartesianSeries,[b.Lines],{drawSeries:function(){this.drawLines();},_setStyles:function(D){if(!D.line){D={line:D};}return b.LineSeries.superclass._setStyles.apply(this,[D]);},_getDefaultStyles:function(){var D=this._mergeStyles({line:this._getLineDefaults()},b.LineSeries.superclass._getDefaultStyles());return D;}},{ATTRS:{type:{value:"line"}}});b.SplineSeries=b.Base.create("splineSeries",b.LineSeries,[b.CurveUtil,b.Lines],{drawSeries:function(){this.drawSpline();}},{ATTRS:{type:{value:"spline"}}});b.AreaSplineSeries=b.Base.create("areaSplineSeries",b.CartesianSeries,[b.Fills,b.CurveUtil],{drawSeries:function(){this.drawAreaSpline();}},{ATTRS:{type:{value:"areaSpline"}}});b.StackedSplineSeries=b.Base.create("stackedSplineSeries",b.SplineSeries,[b.StackingUtil],{setAreaData:function(){b.StackedSplineSeries.superclass.setAreaData.apply(this);this._stackCoordinates.apply(this);}},{ATTRS:{type:{value:"stackedSpline"}}});b.StackedMarkerSeries=b.Base.create("stackedMarkerSeries",b.MarkerSeries,[b.StackingUtil],{setAreaData:function(){b.StackedMarkerSeries.superclass.setAreaData.apply(this);this._stackCoordinates.apply(this);}},{ATTRS:{type:{value:"stackedMarker"}}});b.ColumnSeries=b.Base.create("columnSeries",b.MarkerSeries,[b.Histogram],{_getMarkerDimensions:function(E,D,G,H){var F={left:E+H};if(this._bottomOrigin>=D){F.top=D;F.calculatedSize=this._bottomOrigin-F.top;}else{F.top=this._bottomOrigin;F.calculatedSize=D-this._bottomOrigin;}return F;},updateMarkerState:function(F,R){if(this._markers&&this._markers[R]){var L=b.clone(this.get("styles").marker),V,G=this._getState(F),N=this.get("xcoords"),W=this.get("ycoords"),I=this._markers[R],T,D=this.get("graph"),E,J=D.seriesTypes[this.get("type")],S=J.length,M=0,H=0,P,O=0,K=[],Q=this.get("order"),U;V=G=="off"||!L[G]?b.clone(L):b.clone(L[G]);V.fill.color=this._getItemColor(V.fill.color,R);V.border.color=this._getItemColor(V.border.color,R);U=this._getMarkerDimensions(N[R],W[R],L.width,H);V.height=U.calculatedSize;V.width=Math.min(this._maxSize,V.width);I.set(V);for(;O<S;++O){K[O]=N[R]+M;E=J[O].get("styles").marker;M+=Math.min(this._maxSize,E.width);if(Q>O){H=M;}H-=M/2;}for(O=0;O<S;++O){T=J[O].get("markers");if(T){P=T[R];if(P&&P!==undefined){P.set("x",(K[O]-M/2));}}}}}},{ATTRS:{type:{value:"column"}}});b.BarSeries=b.Base.create("barSeries",b.MarkerSeries,[b.Histogram],{_getMarkerDimensions:function(E,D,G,H){var F={top:D+H};if(E>=this._leftOrigin){F.left=this._leftOrigin;F.calculatedSize=E-F.left;}else{F.left=E;F.calculatedSize=this._leftOrigin-E;}return F;},updateMarkerState:function(F,R){if(this._markers&&this._markers[R]){var K=b.clone(this.get("styles").marker),V,G=this._getState(F),M=this.get("xcoords"),W=this.get("ycoords"),I=this._markers[R],T,D=this.get("graph"),J=D.seriesTypes[this.get("type")],S=J.length,E,L=0,H=0,O,N=0,Q=[],P=this.get("order"),U;V=G=="off"||!K[G]?K:K[G];V.fill.color=this._getItemColor(V.fill.color,R);V.border.color=this._getItemColor(V.border.color,R);U=this._getMarkerDimensions(M[R],W[R],K.height,H);V.width=U.calculatedSize;V.height=Math.min(this._maxSize,V.height);I.set(V);for(;N<S;++N){Q[N]=W[R]+L;E=J[N].get("styles").marker;L+=Math.min(this._maxSize,E.height);if(P>N){H=L;}H-=L/2;}for(N=0;N<S;++N){T=J[N].get("markers");if(T){O=T[R];if(O&&O!==undefined){O.set("y",(Q[N]-L/2));}}}}}},{ATTRS:{type:{value:"bar"},direction:{value:"vertical"}}});b.AreaSeries=b.Base.create("areaSeries",b.CartesianSeries,[b.Fills],{drawSeries:function(){this.drawFill.apply(this,this._getClosingPoints());},_setStyles:function(D){if(!D.area){D={area:D};}return b.AreaSeries.superclass._setStyles.apply(this,[D]);},_getDefaultStyles:function(){var D=this._mergeStyles({area:this._getAreaDefaults()},b.AreaSeries.superclass._getDefaultStyles());return D;}},{ATTRS:{type:{value:"area"}}});b.StackedAreaSplineSeries=b.Base.create("stackedAreaSplineSeries",b.AreaSeries,[b.CurveUtil,b.StackingUtil],{drawSeries:function(){this._stackCoordinates();this.drawStackedAreaSpline();}},{ATTRS:{type:{value:"stackedAreaSpline"}}});b.ComboSeries=b.Base.create("comboSeries",b.CartesianSeries,[b.Fills,b.Lines,b.Plots],{drawSeries:function(){if(this.get("showAreaFill")){this.drawFill.apply(this,this._getClosingPoints());}if(this.get("showLines")){this.drawLines();}if(this.get("showMarkers")){this.drawPlots();}},_toggleVisible:function(H){var G,E,D,F;if(this.get("showAreaFill")&&this._path){this._path.set("visible",H);}if(this.get("showLines")&&this._lineGraphic){this._lineGraphic.set("visible",H);}if(this.get("showMarkers")){G=this.get("markers");if(G){F=0;D=G.length;for(;F<D;++F){E=G[F];
18 if(E){E.set("visible",H);}}}}},_getDefaultStyles:function(){var D=b.ComboSeries.superclass._getDefaultStyles();D.line=this._getLineDefaults();D.marker=this._getPlotDefaults();D.area=this._getAreaDefaults();return D;}},{ATTRS:{type:{value:"combo"},showAreaFill:{value:false},showLines:{value:true},showMarkers:{value:true},marker:{lazyAdd:false,getter:function(){return this.get("styles").marker;},setter:function(D){this.set("styles",{marker:D});}},line:{lazyAdd:false,getter:function(){return this.get("styles").line;},setter:function(D){this.set("styles",{line:D});}},area:{lazyAdd:false,getter:function(){return this.get("styles").area;},setter:function(D){this.set("styles",{area:D});}}}});b.StackedComboSeries=b.Base.create("stackedComboSeries",b.ComboSeries,[b.StackingUtil],{setAreaData:function(){b.StackedComboSeries.superclass.setAreaData.apply(this);this._stackCoordinates.apply(this);},drawSeries:function(){if(this.get("showAreaFill")){this.drawFill.apply(this,this._getStackedClosingPoints());}if(this.get("showLines")){this.drawLines();}if(this.get("showMarkers")){this.drawPlots();}}},{ATTRS:{type:{value:"stackedCombo"},showAreaFill:{value:true}}});b.ComboSplineSeries=b.Base.create("comboSplineSeries",b.ComboSeries,[b.CurveUtil],{drawSeries:function(){if(this.get("showAreaFill")){this.drawAreaSpline();}if(this.get("showLines")){this.drawSpline();}if(this.get("showMarkers")){this.drawPlots();}}},{ATTRS:{type:{value:"comboSpline"}}});b.StackedComboSplineSeries=b.Base.create("stackedComboSplineSeries",b.StackedComboSeries,[b.CurveUtil],{drawSeries:function(){if(this.get("showAreaFill")){this.drawStackedAreaSpline();}if(this.get("showLines")){this.drawSpline();}if(this.get("showMarkers")){this.drawPlots();}}},{ATTRS:{type:{value:"stackedComboSpline"},showAreaFill:{value:true}}});b.StackedLineSeries=b.Base.create("stackedLineSeries",b.LineSeries,[b.StackingUtil],{setAreaData:function(){b.StackedLineSeries.superclass.setAreaData.apply(this);this._stackCoordinates.apply(this);}},{ATTRS:{type:{value:"stackedLine"}}});b.StackedAreaSeries=b.Base.create("stackedAreaSeries",b.AreaSeries,[b.StackingUtil],{setAreaData:function(){b.StackedAreaSeries.superclass.setAreaData.apply(this);this._stackCoordinates.apply(this);},drawSeries:function(){this.drawFill.apply(this,this._getStackedClosingPoints());}},{ATTRS:{type:{value:"stackedArea"}}});b.StackedColumnSeries=b.Base.create("stackedColumnSeries",b.ColumnSeries,[b.StackingUtil],{drawSeries:function(){if(this.get("xcoords").length<1){return;}var V=q.isNumber,ad=b.clone(this.get("styles").marker),U=ad.width,ac=ad.height,W=this.get("xcoords"),ae=this.get("ycoords"),aa=0,ab=W.length,X=ae[0],I=this.get("type"),G=this.get("graph"),R=G.seriesTypes[I],P,Z=this.get("order"),T=this.get("graphOrder"),J,Q,E,O,M,S,Y,F=Z===0,H=ab*U,L={width:[],height:[]},N=[],K=[],D=this.get("groupMarkers");if(q.isArray(ad.fill.color)){E=ad.fill.color.concat();}if(q.isArray(ad.border.color)){O=ad.border.color.concat();}this._createMarkerCache();if(H>this.get("width")){P=this.width/H;U*=P;U=Math.max(U,1);}if(!F){M=R[Z-1];S=M.get("negativeBaseValues");Y=M.get("positiveBaseValues");if(!S||!Y){F=true;Y=[];S=[];}}else{S=[];Y=[];}this.set("negativeBaseValues",S);this.set("positiveBaseValues",Y);for(aa=0;aa<ab;++aa){J=W[aa];X=ae[aa];if(!V(X)||!V(J)){if(F){S[aa]=this._bottomOrigin;Y[aa]=this._bottomOrigin;}this._markers.push(null);continue;}if(F){ac=Math.abs(this._bottomOrigin-X);if(X<this._bottomOrigin){Y[aa]=X;S[aa]=this._bottomOrigin;}else{if(X>this._bottomOrigin){Y[aa]=this._bottomOrigin;S[aa]=X;X-=ac;}else{Y[aa]=X;S[aa]=X;}}}else{if(X>this._bottomOrigin){X+=(S[aa]-this._bottomOrigin);ac=X-S[aa];S[aa]=X;X-=ac;}else{if(X<=this._bottomOrigin){X=Y[aa]-(this._bottomOrigin-X);ac=Y[aa]-X;Y[aa]=X;}}}if(!isNaN(ac)&&ac>0){J-=U/2;if(D){L.width[aa]=U;L.height[aa]=ac;N.push(J);K.push(X);}else{ad.width=U;ad.height=ac;ad.x=J;ad.y=X;if(E){ad.fill.color=E[aa%E.length];}if(O){ad.border.color=O[aa%O.length];}Q=this.getMarker(ad,T,aa);}}else{if(!D){this._markers.push(null);}}}if(D){this._createGroupMarker({fill:ad.fill,border:ad.border,dimensions:L,xvalues:N,yvalues:K,shape:ad.shape});}else{this._clearMarkerCache();}},updateMarkerState:function(K,I){if(this._markers&&this._markers[I]){var M,F,D=this._getState(K),L=this.get("xcoords"),J=this._markers[I],H=0,E,G;M=this.get("styles").marker;H=M.width*0.5;F=D=="off"||!M[D]?b.clone(M):b.clone(M[D]);F.height=J.get("height");F.x=(L[I]-H);F.y=J.get("y");F.id=J.get("id");E=F.fill.color;G=F.border.color;if(q.isArray(E)){F.fill.color=E[I%E.length];}else{F.fill.color=this._getItemColor(F.fill.color,I);}if(q.isArray(G)){F.border.color=G[I%G.length];}else{F.border.color=this._getItemColor(F.border.color,I);}J.set(F);}},_getPlotDefaults:function(){var D={fill:{type:"solid",alpha:1,colors:null,alphas:null,ratios:null},border:{weight:0,alpha:1},width:24,height:24,shape:"rect",padding:{top:0,left:0,right:0,bottom:0}};D.fill.color=this._getDefaultColor(this.get("graphOrder"),"fill");D.border.color=this._getDefaultColor(this.get("graphOrder"),"border");return D;}},{ATTRS:{type:{value:"stackedColumn"},negativeBaseValues:{value:null},positiveBaseValues:{value:null}}});b.StackedBarSeries=b.Base.create("stackedBarSeries",b.BarSeries,[b.StackingUtil],{drawSeries:function(){if(this.get("xcoords").length<1){return;}var U=q.isNumber,ac=b.clone(this.get("styles").marker),T=ac.width,ab=ac.height,V=this.get("xcoords"),ae=this.get("ycoords"),Z=0,aa=V.length,W=ae[0],H=this.get("type"),G=this.get("graph"),Q=G.seriesTypes[H],O,Y=this.get("order"),S=this.get("graphOrder"),I,P,L,R,X,E,N,F=Y===0,ad=aa*ab,K={width:[],height:[]},M=[],J=[],D=this.get("groupMarkers");if(q.isArray(ac.fill.color)){E=ac.fill.color.concat();}if(q.isArray(ac.border.color)){N=ac.border.color.concat();}this._createMarkerCache();if(ad>this.get("height")){O=this.height/ad;ab*=O;ab=Math.max(ab,1);}if(!F){L=Q[Y-1];R=L.get("negativeBaseValues");X=L.get("positiveBaseValues");if(!R||!X){F=true;X=[];R=[];}}else{R=[];X=[];}this.set("negativeBaseValues",R);
19 this.set("positiveBaseValues",X);for(Z=0;Z<aa;++Z){W=ae[Z];I=V[Z];if(!U(W)||!U(I)){if(F){X[Z]=this._leftOrigin;R[Z]=this._leftOrigin;}this._markers.push(null);continue;}if(F){T=Math.abs(I-this._leftOrigin);if(I>this._leftOrigin){X[Z]=I;R[Z]=this._leftOrigin;I-=T;}else{if(I<this._leftOrigin){X[Z]=this._leftOrigin;R[Z]=I;}else{X[Z]=I;R[Z]=this._leftOrigin;}}}else{if(I<this._leftOrigin){I=R[Z]-(this._leftOrigin-V[Z]);T=R[Z]-I;R[Z]=I;}else{if(I>=this._leftOrigin){I+=(X[Z]-this._leftOrigin);T=I-X[Z];X[Z]=I;I-=T;}}}if(!isNaN(T)&&T>0){W-=ab/2;if(D){K.width[Z]=T;K.height[Z]=ab;M.push(I);J.push(W);}else{ac.width=T;ac.height=ab;ac.x=I;ac.y=W;if(E){ac.fill.color=E[Z%E.length];}if(N){ac.border.color=N[Z%N.length];}P=this.getMarker(ac,S,Z);}}else{if(!D){this._markers.push(null);}}}if(D){this._createGroupMarker({fill:ac.fill,border:ac.border,dimensions:K,xvalues:M,yvalues:J,shape:ac.shape});}else{this._clearMarkerCache();}},updateMarkerState:function(L,I){if(this._markers[I]){var D=this._getState(L),H=this.get("ycoords"),J=this._markers[I],M=this.get("styles").marker,K=M.height,F=D=="off"||!M[D]?b.clone(M):b.clone(M[D]),E,G;F.y=(H[I]-K/2);F.x=J.get("x");F.width=J.get("width");F.id=J.get("id");E=F.fill.color;G=F.border.color;if(q.isArray(E)){F.fill.color=E[I%E.length];}else{F.fill.color=this._getItemColor(F.fill.color,I);}if(q.isArray(G)){F.border.color=G[I%G.length];}else{F.border.color=this._getItemColor(F.border.color,I);}J.set(F);}},_getPlotDefaults:function(){var D={fill:{type:"solid",alpha:1,colors:null,alphas:null,ratios:null},border:{weight:0,alpha:1},width:24,height:24,shape:"rect",padding:{top:0,left:0,right:0,bottom:0}};D.fill.color=this._getDefaultColor(this.get("graphOrder"),"fill");D.border.color=this._getDefaultColor(this.get("graphOrder"),"border");return D;}},{ATTRS:{type:{value:"stackedBar"},direction:{value:"vertical"},negativeBaseValues:{value:null},positiveBaseValues:{value:null}}});b.PieSeries=b.Base.create("pieSeries",b.MarkerSeries,[],{_map:null,_image:null,_setMap:function(){var F="pieHotSpotMapi_"+Math.round(100000*Math.random()),D=this.get("graph").get("contentBox"),E;if(this._image){D.removeChild(this._image);while(this._areaNodes&&this._areaNodes.length>0){E=this._areaNodes.shift();this._map.removeChild(E);}D.removeChild(this._map);}this._image=g.createElement("img");this._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAABCAYAAAD9yd/wAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABJJREFUeNpiZGBgSGPAAgACDAAIkABoFyloZQAAAABJRU5ErkJggg==";D.appendChild(this._image);this._image.setAttribute("usemap","#"+F);this._image.style.zIndex=3;this._image.style.opacity=0;this._image.setAttribute("alt","imagemap");this._map=g.createElement("map");this._map.style.zIndex=5;D.appendChild(this._map);this._map.setAttribute("name",F);this._map.setAttribute("id",F);this._areaNodes=[];},_categoryDisplayName:null,_valueDisplayName:null,addListeners:function(){var D=this.get("categoryAxis"),E=this.get("valueAxis");if(D){D.after("dataReady",b.bind(this._categoryDataChangeHandler,this));D.after("dataUpdate",b.bind(this._categoryDataChangeHandler,this));}if(E){E.after("dataReady",b.bind(this._valueDataChangeHandler,this));E.after("dataUpdate",b.bind(this._valueDataChangeHandler,this));}this.after("categoryAxisChange",this.categoryAxisChangeHandler);this.after("valueAxisChange",this.valueAxisChangeHandler);this.after("stylesChange",this._updateHandler);},validate:function(){this.draw();this._renderered=true;},_categoryAxisChangeHandler:function(D){var E=this.get("categoryAxis");E.after("dataReady",b.bind(this._categoryDataChangeHandler,this));E.after("dataUpdate",b.bind(this._categoryDataChangeHandler,this));},_valueAxisChangeHandler:function(D){var E=this.get("valueAxis");E.after("dataReady",b.bind(this._valueDataChangeHandler,this));E.after("dataUpdate",b.bind(this._valueDataChangeHandler,this));},GUID:"pieseries",_categoryDataChangeHandler:function(D){if(this._rendered&&this.get("categoryKey")&&this.get("valueKey")){this.draw();}},_valueDataChangeHandler:function(D){if(this._rendered&&this.get("categoryKey")&&this.get("valueKey")){this.draw();}},draw:function(){var F=this.get("graph"),D=F.get("width"),E=F.get("height");if(isFinite(D)&&isFinite(E)&&D>0&&E>0){this._rendered=true;if(this._drawing){this._callLater=true;return;}this._drawing=true;this._callLater=false;this.drawSeries();this._drawing=false;if(this._callLater){this.draw();}else{this.fire("drawingComplete");}}},drawPlots:function(){var F=this.get("valueAxis").getDataByKey(this.get("valueKey")).concat(),G=this.get("categoryAxis").getDataByKey(this.get("categoryKey")).concat(),J=0,ai=F.length,R=this.get("styles").marker,D=R.fill.colors,aj=R.fill.alphas||["1"],N=R.border.colors,H=[R.border.weight],I=[R.border.alpha],ak=H.concat(),T=N.concat(),V=I.concat(),af,ah,W=R.padding,E=this.get("graph"),P=Math.min(E.get("width"),E.get("height")),U=P-(W.left+W.right),ae=P-(W.top+W.bottom),ac=-90,O=U/2,X=ae/2,K=Math.min(O,X),ad=0,aa,ag=0,Z,ab,L,S,M,Q=this.get("graphOrder"),Y=b.Graphic.NAME=="canvasGraphic";for(;ad<ai;++ad){aa=parseFloat(F[ad]);F.push(aa);if(!isNaN(aa)){J+=aa;}}af=D?D.concat():null;ah=aj?aj.concat():null;this._createMarkerCache();if(Y){this._setMap();this._image.width=U;this._image.height=ae;}for(ad=0;ad<ai;ad++){aa=F[ad];if(J===0){ag=360/F.length;}else{ag=360*(aa/J);}ag=Math.round(ag);if(af&&af.length<1){af=D.concat();}if(ah&&ah.length<1){ah=aj.concat();}if(ak&&ak.length<1){ak=H.concat();}if(ak&&T.length<1){T=N.concat();}if(V&&V.length<1){V=I.concat();}L=ak?ak.shift():null;Z=T?T.shift():null;ab=V?V.shift():null;ac+=ag;S={border:{color:Z,weight:L,alpha:ab},fill:{color:af?af.shift():this._getDefaultColor(ad,"slice"),alpha:ah?ah.shift():null},type:"pieslice",arc:ag,radius:K,startAngle:ac,cx:O,cy:X,width:U,height:ae};M=this.getMarker(S,Q,ad);if(Y){this._addHotspot(S,Q,ad);}}this._clearMarkerCache();},_addHotspot:function(G,T,H){var Q=g.createElement("area"),S=1,M=G.cx,K=G.cy,J=G.arc,R=G.startAngle-J,P=G.startAngle,E=G.radius,N=M+Math.cos(R/180*Math.PI)*E,L=K+Math.sin(R/180*Math.PI)*E,V=M+Math.cos(P/180*Math.PI)*E,U=K+Math.sin(P/180*Math.PI)*E,Y=Math.floor(J/10)-1,F=(J/(Math.floor(J/10))/180)*Math.PI,I=Math.atan((L-K)/(N-M)),X=M+", "+K+", "+N+", "+L,W,O,D;
20 for(S=1;S<=Y;++S){D=F*S;W=Math.cos(I+D);O=Math.sin(I+D);if(R<=90){X+=", "+(M+(E*Math.cos(I+(F*S))));X+=", "+(K+(E*Math.sin(I+(F*S))));}else{X+=", "+(M-(E*Math.cos(I+(F*S))));X+=", "+(K-(E*Math.sin(I+(F*S))));}}X+=", "+V+", "+U;X+=", "+M+", "+K;this._map.appendChild(Q);Q.setAttribute("class",n);Q.setAttribute("id","hotSpot_"+T+"_"+H);Q.setAttribute("shape","polygon");Q.setAttribute("coords",X);this._areaNodes.push(Q);},updateMarkerState:function(H,F){if(this._markers[F]){var J=this._getState(H),E,G,D=this._markers[F],I=this.get("styles").marker;E=J=="off"||!I[J]?I:I[J];G=this._mergeStyles(E,{});G.fill.color=G.fill.colors[F%G.fill.colors.length];G.fill.alpha=G.fill.alphas[F%G.fill.alphas.length];D.set(G);}},_createMarker:function(H,D,G){var I=this.get("graphic"),F,E=b.clone(H);I.set("autoDraw",false);F=I.addShape(E);F.addClass(n);return F;},_clearMarkerCache:function(){var D=this._markerCache.length,F=0,E;for(;F<D;++F){E=this._markerCache[F];if(E){E.destroy();}}this._markerCache=[];},_getPlotDefaults:function(){var D={padding:{top:0,left:0,right:0,bottom:0},fill:{alphas:["1"]},border:{weight:0,alpha:1}};D.fill.colors=this._defaultSliceColors;D.border.colors=this._defaultBorderColors;return D;},_defaultLineColors:["#426ab3","#d09b2c","#000000","#b82837","#b384b5","#ff7200","#779de3","#cbc8ba","#7ed7a6","#007a6c"],_defaultFillColors:["#6084d0","#eeb647","#6c6b5f","#d6484f","#ce9ed1","#ff9f3b","#93b7ff","#e0ddd0","#94ecba","#309687"],_defaultBorderColors:["#205096","#b38206","#000000","#94001e","#9d6fa0","#e55b00","#5e85c9","#adab9e","#6ac291","#006457"],_defaultSliceColors:["#66007f","#a86f41","#295454","#996ab2","#e8cdb7","#90bdbd","#000000","#c3b8ca","#968373","#678585"],_getDefaultColor:function(G,H){var E={line:this._defaultLineColors,fill:this._defaultFillColors,border:this._defaultBorderColors,slice:this._defaultSliceColors},F=E[H],D=F.length;G=G||0;if(G>=D){G=G%D;}H=H||"fill";return E[H][G];}},{ATTRS:{type:{value:"pie"},order:{},graph:{},categoryAxis:{value:null,validator:function(D){return D!==this.get("categoryAxis");}},valueAxis:{value:null,validator:function(D){return D!==this.get("valueAxis");}},categoryKey:{value:null,validator:function(D){return D!==this.get("categoryKey");}},valueKey:{value:null,validator:function(D){return D!==this.get("valueKey");}},categoryDisplayName:{setter:function(D){this._categoryDisplayName=D;return D;},getter:function(){return this._categoryDisplayName||this.get("categoryKey");}},valueDisplayName:{setter:function(D){this._valueDisplayName=D;return D;},getter:function(){return this._valueDisplayName||this.get("valueKey");}},slices:null}});b.Gridlines=b.Base.create("gridlines",b.Base,[b.Renderer],{_path:null,remove:function(){var D=this._path;if(D){D.destroy();}},draw:function(){if(this.get("axis")&&this.get("graph")){this._drawGridlines();}},_drawGridlines:function(){var R,D=this.get("axis"),L=D.get("position"),O,I=0,F,M=this.get("direction"),P=this.get("graph"),N=P.get("width"),K=P.get("height"),Q=this.get("styles").line,H=Q.color,J=Q.weight,G=Q.alpha,E=M=="vertical"?this._verticalLine:this._horizontalLine;if(isFinite(N)&&isFinite(K)&&N>0&&K>0){if(L!="none"&&D&&D.get("tickPoints")){O=D.get("tickPoints");F=O.length;}else{O=[];F=D.get("styles").majorUnit.count;for(;I<F;++I){O[I]={x:N*(I/(F-1)),y:K*(I/(F-1))};}I=0;}R=P.get("gridlines");R.set("width",N);R.set("height",K);R.set("stroke",{weight:J,color:H,opacity:G});for(;I<F;++I){E(R,O[I],N,K);}R.end();}},_horizontalLine:function(G,F,D,E){G.moveTo(0,F.y);G.lineTo(D,F.y);},_verticalLine:function(G,F,D,E){G.moveTo(F.x,0);G.lineTo(F.x,E);},_getDefaultStyles:function(){var D={line:{color:"#f0efe9",weight:1,alpha:1}};return D;}},{ATTRS:{direction:{},axis:{},graph:{}}});b.Graph=b.Base.create("graph",b.Widget,[b.Renderer],{bindUI:function(){var D=this.get("boundingBox");D.setStyle("position","absolute");this.after("widthChange",this._sizeChangeHandler);this.after("heightChange",this._sizeChangeHandler);this.after("stylesChange",this._updateStyles);},syncUI:function(){var D,G,H,L=this.get("seriesCollection"),I,J=0,K=L.length,E=this.get("horizontalGridlines"),F=this.get("verticalGridlines");if(this.get("showBackground")){D=this.get("background");G=this.get("contentBox");H=this.get("styles").background;H.stroke=H.border;H.stroke.opacity=H.stroke.alpha;H.fill.opacity=H.fill.alpha;H.width=this.get("width");H.height=this.get("height");H.type=H.shape;D.set(H);}for(;J<K;++J){I=L[J];if(I instanceof b.CartesianSeries){I.render();}}if(E&&E instanceof b.Gridlines){E.draw();}if(F&&F instanceof b.Gridlines){F.draw();}},seriesTypes:null,getSeriesByIndex:function(F){var D=this.get("seriesCollection"),E;if(D&&D.length>F){E=D[F];}return E;},getSeriesByKey:function(F){var E=this._seriesDictionary,D;if(E&&E.hasOwnProperty(F)){D=E[F];}return D;},addDispatcher:function(D){if(!this._dispatchers){this._dispatchers=[];}this._dispatchers.push(D);},_seriesCollection:null,_seriesDictionary:null,_parseSeriesCollection:function(H){if(!H){return;}var E=H.length,G=0,F,D;if(!this.get("seriesCollection")){this._seriesCollection=[];}if(!this._seriesDictionary){this._seriesDictionary={};}if(!this.seriesTypes){this.seriesTypes=[];}for(;G<E;++G){F=H[G];if(!(F instanceof b.CartesianSeries)&&!(F instanceof b.PieSeries)){this._createSeries(F);continue;}this._addSeries(F);}E=this.get("seriesCollection").length;for(G=0;G<E;++G){F=this.get("seriesCollection")[G];D=F.get("direction")=="horizontal"?"yKey":"xKey";this._seriesDictionary[F.get(D)]=F;}},_addSeries:function(F){var G=F.get("type"),I=this.get("seriesCollection"),H=I.length,E=this.seriesTypes,D;if(!F.get("graph")){F.set("graph",this);}I.push(F);if(!E.hasOwnProperty(G)){this.seriesTypes[G]=[];}D=this.seriesTypes[G];F.set("graphOrder",H);F.set("order",D.length);D.push(F);this.addDispatcher(F);F.after("drawingComplete",b.bind(this._drawingCompleteHandler,this));this.fire("seriesAdded",F);},_createSeries:function(H){var I=H.type,J=this.get("seriesCollection"),F=this.seriesTypes,E,D,G;H.graph=this;if(!F.hasOwnProperty(I)){F[I]=[];
21 }E=F[I];H.graph=this;H.order=E.length;H.graphOrder=J.length;D=this._getSeries(H.type);G=new D(H);this.addDispatcher(G);G.after("drawingComplete",b.bind(this._drawingCompleteHandler,this));E.push(G);J.push(G);},_seriesMap:{line:b.LineSeries,column:b.ColumnSeries,bar:b.BarSeries,area:b.AreaSeries,candlestick:b.CandlestickSeries,ohlc:b.OHLCSeries,stackedarea:b.StackedAreaSeries,stackedline:b.StackedLineSeries,stackedcolumn:b.StackedColumnSeries,stackedbar:b.StackedBarSeries,markerseries:b.MarkerSeries,spline:b.SplineSeries,areaspline:b.AreaSplineSeries,stackedspline:b.StackedSplineSeries,stackedareaspline:b.StackedAreaSplineSeries,stackedmarkerseries:b.StackedMarkerSeries,pie:b.PieSeries,combo:b.ComboSeries,stackedcombo:b.StackedComboSeries,combospline:b.ComboSplineSeries,stackedcombospline:b.StackedComboSplineSeries},_getSeries:function(D){var E;if(q.isString(D)){E=this._seriesMap[D];}else{E=D;}return E;},_markerEventHandler:function(I){var G=I.type,D=I.currentTarget,H=D.getAttribute("id").split("_"),F=this.getSeriesByIndex(H[1]),E=H[2];F.updateMarkerState(G,E);},_dispatchers:null,_updateStyles:function(){var E=this.get("styles").background,D=E.border;D.opacity=D.alpha;E.stroke=D;E.fill.opacity=E.fill.alpha;this.get("background").set(E);this._sizeChangeHandler();},_sizeChangeHandler:function(J){var D=this.get("horizontalGridlines"),K=this.get("verticalGridlines"),E=this.get("width"),H=this.get("height"),G=this.get("styles").background,I,F;if(G&&G.border){I=G.border.weight||0;}if(this.get("showBackground")){F=this.get("background");if(E&&H){F.set("width",E);F.set("height",H);}}if(this._gridlines){this._gridlines.clear();}if(D&&D instanceof b.Gridlines){D.draw();}if(K&&K instanceof b.Gridlines){K.draw();}this._drawSeries();},_drawSeries:function(){if(this._drawing){this._callLater=true;return;}var F,E,D,G=this.get("graphic");G.set("autoDraw",false);this._callLater=false;this._drawing=true;F=this.get("seriesCollection");E=0;D=F.length;for(;E<D;++E){F[E].draw();if((!F[E].get("xcoords")||!F[E].get("ycoords"))&&!F[E] instanceof b.PieSeries){this._callLater=true;break;}}this._drawing=false;if(this._callLater){this._drawSeries();}},_drawingCompleteHandler:function(F){var E=F.currentTarget,G,D=b.Array.indexOf(this._dispatchers,E);if(D>-1){this._dispatchers.splice(D,1);}if(this._dispatchers.length<1){G=this.get("graphic");if(!G.get("autoDraw")){G._redraw();}this.fire("chartRendered");}},_getDefaultStyles:function(){var D={background:{shape:"rect",fill:{color:"#faf9f2"},border:{color:"#dad8c9",weight:1}}};return D;},destructor:function(){if(this._graphic){this._graphic.destroy();}if(this._background){this._background.get("graphic").destroy();}if(this._gridlines){this._gridlines.get("graphic").destroy();}}},{ATTRS:{x:{setter:function(D){this.get("boundingBox").setStyle("left",D+"px");return D;}},y:{setter:function(D){this.get("boundingBox").setStyle("top",D+"px");return D;}},chart:{},seriesCollection:{getter:function(){return this._seriesCollection;},setter:function(D){this._parseSeriesCollection(D);return this._seriesCollection;}},showBackground:{value:true},seriesDictionary:{readOnly:true,getter:function(){return this._seriesDictionary;}},horizontalGridlines:{value:null,setter:function(E){var D=this.get("horizontalGridlines");if(D&&D instanceof b.Gridlines){D.remove();}if(E instanceof b.Gridlines){D=E;E.set("graph",this);return E;}else{if(E&&E.axis){D=new b.Gridlines({direction:"horizontal",axis:E.axis,graph:this,styles:E.styles});return D;}}}},verticalGridlines:{value:null,setter:function(E){var D=this.get("verticalGridlines");if(D&&D instanceof b.Gridlines){D.remove();}if(E instanceof b.Gridlines){D=E;E.set("graph",this);return E;}else{if(E&&E.axis){D=new b.Gridlines({direction:"vertical",axis:E.axis,graph:this,styles:E.styles});return D;}}}},background:{getter:function(){if(!this._background){this._backgroundGraphic=new b.Graphic({render:this.get("contentBox")});this._backgroundGraphic.get("node").style.zIndex=0;this._background=this._backgroundGraphic.addShape({type:"rect"});}return this._background;}},gridlines:{readOnly:true,getter:function(){if(!this._gridlines){this._gridlinesGraphic=new b.Graphic({render:this.get("contentBox")});this._gridlinesGraphic.get("node").style.zIndex=1;this._gridlines=this._gridlinesGraphic.addShape({type:"path"});}return this._gridlines;}},graphic:{readOnly:true,getter:function(){if(!this._graphic){this._graphic=new b.Graphic({render:this.get("contentBox")});this._graphic.get("node").style.zIndex=2;this._graphic.set("autoDraw",false);}return this._graphic;}},groupMarkers:{value:false}}});function o(){}o.ATTRS={ariaLabel:{value:"Chart Application",setter:function(E){var D=this.get("contentBox");if(D){D.setAttribute("aria-label",E);}return E;}},ariaDescription:{value:"Use the up and down keys to navigate between series. Use the left and right keys to navigate through items in a series.",setter:function(D){if(this._description){this._description.setContent("");this._description.appendChild(g.createTextNode(D));}return D;}},tooltip:{valueFn:"_getTooltip",setter:function(D){return this._updateTooltip(D);}},categoryKey:{value:"category"},categoryType:{value:"category"},interactionType:{value:"marker"},dataProvider:{setter:function(D){return this._setDataValues(D);}},seriesKeys:{},axesCollection:{},graph:{valueFn:"_getGraph"},groupMarkers:{value:false,setter:function(D){if(this.get("graph")){this.get("graph").set("groupMarkers",D);}return D;}}};o.prototype={_itemRendered:function(D){this._itemRenderQueue=this._itemRenderQueue.splice(1+b.Array.indexOf(this._itemRenderQueue,D.currentTarget),1);if(this._itemRenderQueue.length<1){this._redraw();}},_getGraph:function(){var D=new b.Graph({chart:this,groupMarkers:this.get("groupMarkers")});D.after("chartRendered",b.bind(function(E){this.fire("chartRendered");},this));return D;},getSeries:function(F){var D=null,E=this.get("graph");if(E){if(q.isNumber(F)){D=E.getSeriesByIndex(F);}else{D=E.getSeriesByKey(F);}}return D;},getAxisByKey:function(F){var D,E=this.get("axes");
22 if(E&&E.hasOwnProperty(F)){D=E[F];}return D;},getCategoryAxis:function(){var E,D=this.get("categoryKey"),F=this.get("axes");if(F.hasOwnProperty(D)){E=F[D];}return E;},_direction:"horizontal",_dataProvider:null,_setDataValues:function(I){if(q.isArray(I[0])){var H,K=[],F=I[0],G=0,E=F.length,J,D=I.length;for(;G<E;++G){H={category:F[G]};for(J=1;J<D;++J){H["series"+J]=I[J][G];}K[G]=H;}return K;}return I;},_seriesCollection:null,_setSeriesCollection:function(D){this._seriesCollection=D;},_getAxisClass:function(D){return this._axisClass[D];},_axisClass:{stacked:b.StackedAxis,numeric:b.NumericAxis,category:b.CategoryAxis,time:b.TimeAxis},_axes:null,initializer:function(){this._itemRenderQueue=[];this._seriesIndex=-1;this._itemIndex=-1;this.after("dataProviderChange",this._dataProviderChangeHandler);},renderUI:function(){var E=this.get("tooltip"),F=this.get("boundingBox"),D=this.get("contentBox");F.setStyle("position","absolute");D.setStyle("position","absolute");this._addAxes();this._addSeries();if(E&&E.show){this._addTooltip();}this._setAriaElements(F,D);},_setAriaElements:function(G,E){var F=this._getAriaOffscreenNode(),H=this.get("id")+"_description",D=this._getAriaOffscreenNode();E.set("tabIndex",0);E.set("role","img");E.setAttribute("aria-label",this.get("ariaLabel"));E.setAttribute("aria-describedby",H);F.set("id",H);F.set("tabIndex",-1);F.appendChild(g.createTextNode(this.get("ariaDescription")));D.set("id","live-region");D.set("aria-live","polite");D.set("aria-atomic","true");D.set("role","status");G.setAttribute("role","application");G.appendChild(F);G.appendChild(D);this._description=F;this._liveRegion=D;},_getAriaOffscreenNode:function(){var E=b.Node.create("<div></div>"),F=b.UA.ie,D=(F&&F<8)?"rect(1px 1px 1px 1px)":"rect(1px, 1px, 1px, 1px)";E.setStyle("position","absolute");E.setStyle("height","1px");E.setStyle("width","1px");E.setStyle("overflow","hidden");E.setStyle("clip",D);return E;},syncUI:function(){this._redraw();},bindUI:function(){this.after("tooltipChange",b.bind(this._tooltipChangeHandler,this));this.after("widthChange",this._sizeChanged);this.after("heightChange",this._sizeChanged);var K=this.get("tooltip"),E="mouseout",L="mouseover",F=this.get("contentBox"),D=this.get("interactionType"),I=0,J,H="."+n,G=((v&&("ontouchstart" in v))&&!(b.UA.chrome&&b.UA.chrome<6));b.on("keydown",b.bind(function(O){var N=O.keyCode,M=parseFloat(N),P;if(M>36&&M<41){O.halt();P=this._getAriaMessage(M);this._liveRegion.setContent("");this._liveRegion.appendChild(g.createTextNode(P));}},this),this.get("contentBox"));if(D=="marker"){E=K.hideEvent;L=K.showEvent;if(G){b.delegate("touchend",b.bind(this._markerEventDispatcher,this),F,H);b.on("touchend",b.bind(function(M){M.halt(true);if(this._activeMarker){this._activeMarker=null;this.hideTooltip(M);}},this));}else{b.delegate("mouseenter",b.bind(this._markerEventDispatcher,this),F,H);b.delegate("mousedown",b.bind(this._markerEventDispatcher,this),F,H);b.delegate("mouseup",b.bind(this._markerEventDispatcher,this),F,H);b.delegate("mouseleave",b.bind(this._markerEventDispatcher,this),F,H);b.delegate("click",b.bind(this._markerEventDispatcher,this),F,H);b.delegate("mousemove",b.bind(this._positionTooltip,this),F,H);}}else{if(D=="planar"){if(G){this._overlay.on("touchend",b.bind(this._planarEventDispatcher,this));}else{this._overlay.on("mousemove",b.bind(this._planarEventDispatcher,this));this.on("mouseout",this.hideTooltip);}}}if(K){this.on("markerEvent:touchend",b.bind(function(N){var M=N.series.get("markers")[N.index];if(this._activeMarker&&M===this._activeMarker){this._activeMarker=null;this.hideTooltip(N);}else{this._activeMarker=M;K.markerEventHandler.apply(this,[N]);}},this));if(E&&L&&E==L){this.on(D+"Event:"+E,this.toggleTooltip);}else{if(L){this.on(D+"Event:"+L,K[D+"EventHandler"]);}if(E){if(q.isArray(E)){J=E.length;for(;I<J;++I){this.on(D+"Event:"+E[I],this.hideTooltip);}}this.on(D+"Event:"+E,this.hideTooltip);}}}},_markerEventDispatcher:function(K){var M=K.type,D=this.get("contentBox"),Q=K.currentTarget,P=Q.getAttribute("id").split("_"),J=P.pop(),H=P.pop(),I=this.getSeries(parseInt(H,10)),L=this.getSeriesItems(I,J),F=K&&K.hasOwnProperty("changedTouches"),G=F?K.changedTouches[0].pageX:K.pageX,E=F?K.changedTouches[0].pageY:K.pageY,O=G-D.getX(),N=E-D.getY();if(M=="mouseenter"){M="mouseover";}else{if(M=="mouseleave"){M="mouseout";}}I.updateMarkerState(M,J);K.halt();this.fire("markerEvent:"+M,{originEvent:K,pageX:G,pageY:E,categoryItem:L.category,valueItem:L.value,node:Q,x:O,y:N,series:I,index:J,seriesIndex:H});},_dataProviderChangeHandler:function(H){var E=this.get("dataProvider"),G=this.get("axes"),D,F;this._seriesIndex=-1;this._itemIndex=-1;if(G){for(D in G){if(G.hasOwnProperty(D)){F=G[D];if(F instanceof b.Axis){if(F.get("position")!="none"){this._addToAxesRenderQueue(F);}F.set("dataProvider",E);}}}}},toggleTooltip:function(E){var D=this.get("tooltip");if(D.visible){this.hideTooltip();}else{D.markerEventHandler.apply(this,[E]);}},_showTooltip:function(G,D,H){var E=this.get("tooltip"),F=E.node;if(G){E.visible=true;E.setTextFunction(F,G);F.setStyle("top",H+"px");F.setStyle("left",D+"px");F.setStyle("visibility","visible");}},_positionTooltip:function(H){var F=this.get("tooltip"),G=F.node,E=this.get("contentBox"),D=(H.pageX+10)-E.getX(),I=(H.pageY+10)-E.getY();if(G){G.setStyle("left",D+"px");G.setStyle("top",I+"px");}},hideTooltip:function(){var D=this.get("tooltip"),E=D.node;D.visible=false;E.set("innerHTML","");E.setStyle("left",-10000);E.setStyle("top",-10000);E.setStyle("visibility","hidden");},_addTooltip:function(){var E=this.get("tooltip"),G=this.get("id")+"_tooltip",D=this.get("contentBox"),F=g.getElementById(G);if(F){D.removeChild(F);}E.node.set("id",G);E.node.setStyle("visibility","hidden");D.appendChild(E.node);},_updateTooltip:function(I){var F=this._tooltip,D,H,G,E={markerLabelFunction:"markerLabelFunction",planarLabelFunction:"planarLabelFunction",setTextFunction:"setTextFunction",showEvent:"showEvent",hideEvent:"hideEvent",markerEventHandler:"markerEventHandler",planarEventHandler:"planarEventHandler",show:"show"};
23 if(q.isObject(I)){H=I.styles;G=b.one(I.node)||F.node;if(H){for(D in H){if(H.hasOwnProperty(D)){G.setStyle(D,H[D]);}}}for(D in E){if(I.hasOwnProperty(D)){F[D]=I[D];}}F.node=G;}return F;},_getTooltip:function(){var E=g.createElement("div"),D={setTextFunction:this._setText,markerLabelFunction:this._tooltipLabelFunction,planarLabelFunction:this._planarLabelFunction,show:true,hideEvent:"mouseout",showEvent:"mouseover",markerEventHandler:function(G){var F=this.get("tooltip"),H=F.markerLabelFunction.apply(this,[G.categoryItem,G.valueItem,G.index,G.series,G.seriesIndex]);this._showTooltip(H,G.x+10,G.y+10);},planarEventHandler:function(G){var F=this.get("tooltip"),I,H=this.get("categoryAxis");I=F.planarLabelFunction.apply(this,[H,G.valueItem,G.index,G.items,G.seriesIndex]);this._showTooltip(I,G.x+10,G.y+10);}};E=b.one(E);E.set("id",this.get("id")+"_tooltip");E.setStyle("fontSize","85%");E.setStyle("opacity","0.83");E.setStyle("position","absolute");E.setStyle("paddingTop","2px");E.setStyle("paddingRight","5px");E.setStyle("paddingBottom","4px");E.setStyle("paddingLeft","2px");E.setStyle("backgroundColor","#fff");E.setStyle("border","1px solid #dbdccc");E.setStyle("pointerEvents","none");E.setStyle("zIndex",3);E.setStyle("whiteSpace","noWrap");E.setStyle("visibility","hidden");D.node=b.one(E);this._tooltip=D;return D;},_planarLabelFunction:function(K,P,M,I,G){var E=g.createElement("div"),N,J=0,L=I.length,F,D,O,H;if(K){D=K.get("labelFunction").apply(this,[K.getKeyValueAt(this.get("categoryKey"),M),K.get("labelFormat")]);if(!q.isObject(D)){D=g.createTextNode(D);}E.appendChild(D);}for(;J<L;++J){H=I[J];if(H.get("visible")){N=P[J];F=N.axis;O=F.get("labelFunction").apply(this,[F.getKeyValueAt(N.key,M),F.get("labelFormat")]);E.appendChild(g.createElement("br"));E.appendChild(g.createTextNode(N.displayName));E.appendChild(g.createTextNode(": "));if(!q.isObject(O)){O=g.createTextNode(O);}E.appendChild(O);}}return E;},_tooltipLabelFunction:function(K,E,H,G,F){var J=g.createElement("div"),D=K.axis.get("labelFunction").apply(this,[K.value,K.axis.get("labelFormat")]),I=E.axis.get("labelFunction").apply(this,[E.value,E.axis.get("labelFormat")]);J.appendChild(g.createTextNode(K.displayName));J.appendChild(g.createTextNode(": "));if(!q.isObject(D)){D=g.createTextNode(D);}J.appendChild(D);J.appendChild(g.createElement("br"));J.appendChild(g.createTextNode(E.displayName));J.appendChild(g.createTextNode(": "));if(!q.isObject(I)){I=g.createTextNode(I);}J.appendChild(I);return J;},_tooltipChangeHandler:function(H){if(this.get("tooltip")){var F=this.get("tooltip"),G=F.node,E=F.show,D=this.get("contentBox");if(G&&E){if(!D.contains(G)){this._addTooltip();}}}},_setText:function(D,E){D.setContent("");if(q.isNumber(E)){E=E+"";}else{if(!E){E="";}}if(m(E)){E=g.createTextNode(E);}D.appendChild(E);}};b.ChartBase=o;b.CartesianChart=b.Base.create("cartesianChart",b.Widget,[b.ChartBase],{renderUI:function(){var H=this.get("boundingBox"),D=this.get("contentBox"),G=this.get("tooltip"),E,F=c("overlay");H.setStyle("position","absolute");D.setStyle("position","absolute");this._addAxes();this._addGridlines();this._addSeries();if(G&&G.show){this._addTooltip();}this.get("styles");if(this.get("interactionType")=="planar"){E=g.createElement("div");this.get("contentBox").appendChild(E);this._overlay=b.one(E);this._overlay.setStyle("position","absolute");this._overlay.setStyle("background","#fff");this._overlay.setStyle("opacity",0);this._overlay.addClass(F);this._overlay.setStyle("zIndex",4);}this._setAriaElements(H,D);this._redraw();},_planarEventDispatcher:function(Z){var G=this.get("graph"),K=this.get("boundingBox"),T=G.get("contentBox"),Q=Z&&Z.hasOwnProperty("changedTouches"),F=Q?Z.changedTouches[0].pageX:Z.pageX,D=Q?Z.changedTouches[0].pageY:Z.pageY,O=F-K.getX(),N=D-K.getY(),L={x:F-T.getX(),y:D-T.getY()},E=G.get("seriesCollection"),P,X=0,M,J=this._selectedIndex,ab,S=[],H=[],R=[],ac=this.get("direction"),ad,aa,V,U,I,Y,W;Z.halt(true);if(ac=="horizontal"){aa="x";V="y";}else{V="x";aa="y";}U=L[aa];if(E){Y=E.length;while(X<Y&&!I){if(E[X]){I=E[X].get(aa+"MarkerPlane");}X++;}}if(I){Y=I.length;for(X=0;X<Y;++X){if(U<=I[X].end&&U>=I[X].start){M=X;break;}}Y=E.length;for(X=0;X<Y;++X){P=E[X];W=P.get(V+"coords");ad=P.get("markers");if(ad&&!isNaN(J)&&J>-1){P.updateMarkerState("mouseout",J);}if(W&&W[M]>-1){if(ad&&!isNaN(M)&&M>-1){P.updateMarkerState("mouseover",M);}ab=this.getSeriesItems(P,M);H.push(ab.category);R.push(ab.value);S.push(P);}}this._selectedIndex=M;if(M>-1){this.fire("planarEvent:mouseover",{categoryItem:H,valueItem:R,x:O,y:N,pageX:F,pageY:D,items:S,index:M,originEvent:Z});}else{this.fire("planarEvent:mouseout");}}},_type:"combo",_itemRenderQueue:null,_addToAxesRenderQueue:function(D){if(!this._itemRenderQueue){this._itemRenderQueue=[];}if(b.Array.indexOf(this._itemRenderQueue,D)<0){this._itemRenderQueue.push(D);}},_addToAxesCollection:function(D,F){var E=this.get(D+"AxesCollection");if(!E){E=[];this.set(D+"AxesCollection",E);}E.push(F);},_getDefaultSeriesCollection:function(){return this._parseSeriesCollection();},_parseSeriesCollection:function(W){var M=this.get("direction"),D=W||[],T,Q,O=[],J,I=this.get("seriesKeys").concat(),S,H,P,G=this.get("type"),U,L,V,E,F=this.get("categoryKey"),R=this.get("showMarkers"),N=this.get("showAreaFill"),K=this.get("showLines");if(M=="vertical"){T="yAxis";L="yKey";Q="xAxis";V="xKey";}else{T="xAxis";L="xKey";Q="yAxis";V="yKey";}P=D.length;for(S=0;S<P;++S){U=this._getBaseAttribute(D[S],V);if(U){H=b.Array.indexOf(I,U);if(H>-1){I.splice(H,1);}O.push(U);}}if(I.length>0){O=O.concat(I);}P=O.length;for(S=0;S<P;++S){J=D[S]||{type:G};if(J instanceof b.CartesianSeries){this._parseSeriesAxes(J);continue;}J[L]=J[L]||F;J[V]=J[V]||I.shift();J[T]=this._getCategoryAxis();J[Q]=this._getSeriesAxis(J[V]);J.type=J.type||G;if((J.type=="combo"||J.type=="stackedcombo"||J.type=="combospline"||J.type=="stackedcombospline")){if(N!==null){J.showAreaFill=(J.showAreaFill!==null&&J.showAreaFill!==undefined)?J.showAreaFill:N;}if(R!==null){J.showMarkers=(J.showMarkers!==null&&J.showMarkers!==undefined)?J.showMarkers:R;
24 }if(K!==null){J.showLines=(J.showLines!==null&&J.showLines!==undefined)?J.showLines:K;}}D[S]=J;}if(W){E=this.get("graph");E.set("seriesCollection",D);D=E.get("seriesCollection");}return D;},_parseSeriesAxes:function(E){var I=this.get("axes"),G=E.get("xAxis"),D=E.get("yAxis"),H=b.Axis,F;if(G&&!(G instanceof H)&&q.isString(G)&&I.hasOwnProperty(G)){F=I[G];if(F instanceof H){E.set("xAxis",F);}}if(D&&!(D instanceof H)&&q.isString(D)&&I.hasOwnProperty(D)){F=I[D];if(F instanceof H){E.set("yAxis",F);}}},_getCategoryAxis:function(){var D,E=this.get("axes"),F=this.get("categoryAxisName")||this.get("categoryKey");D=E[F];return D;},_getSeriesAxis:function(E,I){var H=this.get("axes"),D,G,F;if(H){if(I&&H.hasOwnProperty(I)){F=H[I];}else{for(D in H){if(H.hasOwnProperty(D)){G=H[D].get("keys");if(G&&G.hasOwnProperty(E)){F=H[D];break;}}}}}return F;},_getBaseAttribute:function(E,D){if(E instanceof b.Base){return E.get(D);}if(E.hasOwnProperty(D)){return E[D];}return null;},_setBaseAttribute:function(E,D,F){if(E instanceof b.Base){E.set(D,F);}else{E[D]=F;}},_setAxes:function(E){var I=this._parseAxes(E),M={},G={edgeOffset:"edgeOffset",position:"position",overlapGraph:"overlapGraph",labelFunction:"labelFunction",labelFunctionScope:"labelFunctionScope",labelFormat:"labelFormat",maximum:"maximum",minimum:"minimum",roundingMethod:"roundingMethod",alwaysShowZero:"alwaysShowZero",title:"title",width:"width",height:"height"},H=this.get("dataProvider"),P,J,Q,F,K,O,N,D,L;for(J in I){if(I.hasOwnProperty(J)){O=I[J];if(O instanceof b.Axis){F=O;}else{F=null;D={};D.dataProvider=O.dataProvider||H;D.keys=O.keys;if(O.hasOwnProperty("roundingUnit")){D.roundingUnit=O.roundingUnit;}Q=O.position;if(O.styles){D.styles=O.styles;}D.position=O.position;for(P in G){if(G.hasOwnProperty(P)&&O.hasOwnProperty(P)){D[P]=O[P];}}if(E){F=this.getAxisByKey(J);}if(F&&F instanceof b.Axis){K=F.get("position");if(Q!=K){if(K!="none"){L=this.get(K+"AxesCollection");L.splice(b.Array.indexOf(L,F),1);}if(Q!="none"){this._addToAxesCollection(Q,F);}}F.setAttrs(D);}else{N=this._getAxisClass(O.type);F=new N(D);F.after("axisRendered",b.bind(this._itemRendered,this));}}if(F){L=this.get(Q+"AxesCollection");if(L&&b.Array.indexOf(L,F)>0){F.set("overlapGraph",false);}M[J]=F;}}}return M;},_addAxes:function(){var I=this.get("axes"),E,G,J,D=this.get("width"),F=this.get("height"),H=b.Node.one(this._parentNode);if(!this._axesCollection){this._axesCollection=[];}for(E in I){if(I.hasOwnProperty(E)){G=I[E];if(G instanceof b.Axis){if(!D){this.set("width",H.get("offsetWidth"));D=this.get("width");}if(!F){this.set("height",H.get("offsetHeight"));F=this.get("height");}this._addToAxesRenderQueue(G);J=G.get("position");if(!this.get(J+"AxesCollection")){this.set(J+"AxesCollection",[G]);}else{this.get(J+"AxesCollection").push(G);}this._axesCollection.push(G);if(G.get("keys").hasOwnProperty(this.get("categoryKey"))){this.set("categoryAxis",G);}G.render(this.get("contentBox"));}}}},_addSeries:function(){var D=this.get("graph"),E=this.get("seriesCollection");D.render(this.get("contentBox"));},_addGridlines:function(){var N=this.get("graph"),E=this.get("horizontalGridlines"),F=this.get("verticalGridlines"),M=this.get("direction"),O=this.get("leftAxesCollection"),I=this.get("rightAxesCollection"),K=this.get("bottomAxesCollection"),G=this.get("topAxesCollection"),H,D=this.get("categoryAxis"),L,J;if(this._axesCollection){H=this._axesCollection.concat();H.splice(b.Array.indexOf(H,D),1);}if(E){if(O&&O[0]){L=O[0];}else{if(I&&I[0]){L=I[0];}else{L=M=="horizontal"?D:H[0];}}if(!this._getBaseAttribute(E,"axis")&&L){this._setBaseAttribute(E,"axis",L);}if(this._getBaseAttribute(E,"axis")){N.set("horizontalGridlines",E);}}if(F){if(K&&K[0]){J=K[0];}else{if(G&&G[0]){J=G[0];}else{J=M=="vertical"?D:H[0];}}if(!this._getBaseAttribute(F,"axis")&&J){this._setBaseAttribute(F,"axis",J);}if(this._getBaseAttribute(F,"axis")){N.set("verticalGridlines",F);}}},_getAllKeys:function(I){var F=0,D=I.length,H,E,G={};for(;F<D;++F){H=I[F];for(E in H){if(H.hasOwnProperty(E)){G[E]=true;}}}return G;},_getDefaultAxes:function(){return this._parseAxes();},_parseAxes:function(V){var N=this.get("categoryKey"),E,T,P,G={},R=[],F=this.get("categoryAxisName")||this.get("categoryKey"),D=this.get("valueAxisName"),H=this.get("seriesKeys")||[],W,U,M,K,Q,O,S=this.get("dataProvider"),X=this.get("direction"),L,I,J=[],Y=this.get("stacked")?"stacked":"numeric";if(X=="vertical"){L="bottom";I="left";}else{L="left";I="bottom";}if(V){for(W in V){if(V.hasOwnProperty(W)){E=V[W];P=this._getBaseAttribute(E,"keys");T=this._getBaseAttribute(E,"type");if(T=="time"||T=="category"){F=W;this.set("categoryAxisName",W);if(q.isArray(P)&&P.length>0){N=P[0];this.set("categoryKey",N);}G[W]=E;}else{if(W==F){G[W]=E;}else{G[W]=E;if(W!=D&&P&&q.isArray(P)){K=P.length;for(M=0;M<K;++M){R.push(P[M]);}J.push(G[W]);}if(!(this._getBaseAttribute(G[W],"type"))){this._setBaseAttribute(G[W],"type",Y);}if(!(this._getBaseAttribute(G[W],"position"))){this._setBaseAttribute(G[W],"position",this._getDefaultAxisPosition(G[W],J,L));}}}}}}if(H.length<1){O=this._getAllKeys(S);for(W in O){if(O.hasOwnProperty(W)&&W!=N&&b.Array.indexOf(R,W)==-1){H.push(W);}}}Q=b.Array.indexOf(H,N);if(Q>-1){H.splice(Q,1);}U=R.length;for(W=0;W<U;++W){Q=b.Array.indexOf(H,R[W]);if(Q>-1){H.splice(Q,1);}}if(!G.hasOwnProperty(F)){G[F]={};}if(!(this._getBaseAttribute(G[F],"keys"))){this._setBaseAttribute(G[F],"keys",[N]);}if(!(this._getBaseAttribute(G[F],"position"))){this._setBaseAttribute(G[F],"position",I);}if(!(this._getBaseAttribute(G[F],"type"))){this._setBaseAttribute(G[F],"type",this.get("categoryType"));}if(!G.hasOwnProperty(D)&&H&&H.length>0){G[D]={keys:H};J.push(G[D]);}if(R.length>0){if(H.length>0){H=R.concat(H);}else{H=R;}}if(G.hasOwnProperty(D)){if(!(this._getBaseAttribute(G[D],"position"))){this._setBaseAttribute(G[D],"position",this._getDefaultAxisPosition(G[D],J,L));}if(!(this._getBaseAttribute(G[D],"type"))){this._setBaseAttribute(G[D],"type",Y);}if(!(this._getBaseAttribute(G[D],"keys"))){this._setBaseAttribute(G[D],"keys",H);
25 }}this.set("seriesKeys",H);return G;},_getDefaultAxisPosition:function(G,E,D){var H=this.get("direction"),F=b.Array.indexOf(E,G);if(E[F-1]&&E[F-1].position){if(H=="horizontal"){if(E[F-1].position=="left"){D="right";}else{if(E[F-1].position=="right"){D="left";}}}else{if(E[F-1].position=="bottom"){D="top";}else{D="bottom";}}}return D;},getSeriesItems:function(I,H){var J=I.get("xAxis"),F=I.get("yAxis"),G=I.get("xKey"),E=I.get("yKey"),K,D;if(this.get("direction")=="vertical"){K={axis:F,key:E,value:F.getKeyValueAt(E,H)};D={axis:J,key:G,value:J.getKeyValueAt(G,H)};}else{D={axis:F,key:E,value:F.getKeyValueAt(E,H)};K={axis:J,key:G,value:J.getKeyValueAt(G,H)};}K.displayName=I.get("categoryDisplayName");D.displayName=I.get("valueDisplayName");K.value=K.axis.getKeyValueAt(K.key,H);D.value=D.axis.getKeyValueAt(D.key,H);return{category:K,value:D};},_sizeChanged:function(G){if(this._axesCollection){var F=this._axesCollection,E=0,D=F.length;for(;E<D;++E){this._addToAxesRenderQueue(F[E]);}this._redraw();}},_getTopOverflow:function(I,G,E){var F=0,D,J=0,H;if(I){D=I.length;for(;F<D;++F){H=I[F];J=Math.max(J,Math.abs(H.getMaxLabelBounds().top)-(H.getEdgeOffset(H.get("styles").majorTicks.count,E)*0.5));}}if(G){F=0;D=G.length;for(;F<D;++F){H=G[F];J=Math.max(J,Math.abs(H.getMaxLabelBounds().top)-(H.getEdgeOffset(H.get("styles").majorTicks.count,E)*0.5));}}return J;},_getRightOverflow:function(I,F,H){var E=0,D,J=0,G;if(I){D=I.length;for(;E<D;++E){G=I[E];J=Math.max(J,G.getMaxLabelBounds().right-(G.getEdgeOffset(G.get("styles").majorTicks.count,H)*0.5));}}if(F){E=0;D=F.length;for(;E<D;++E){G=F[E];J=Math.max(J,G.getMaxLabelBounds().right-(G.getEdgeOffset(G.get("styles").majorTicks.count,H)*0.5));}}return J;},_getLeftOverflow:function(I,F,H){var E=0,D,J=0,G;if(I){D=I.length;for(;E<D;++E){G=I[E];J=Math.max(J,Math.abs(G.getMinLabelBounds().left)-(G.getEdgeOffset(G.get("styles").majorTicks.count,H)*0.5));}}if(F){E=0;D=F.length;for(;E<D;++E){G=F[E];J=Math.max(J,Math.abs(G.getMinLabelBounds().left)-(G.getEdgeOffset(G.get("styles").majorTicks.count,H)*0.5));}}return J;},_getBottomOverflow:function(I,G,E){var F=0,D,J=0,H;if(I){D=I.length;for(;F<D;++F){H=I[F];J=Math.max(J,H.getMinLabelBounds().bottom-(H.getEdgeOffset(H.get("styles").majorTicks.count,E)*0.5));}}if(G){F=0;D=G.length;for(;F<D;++F){H=G[F];J=Math.max(J,H.getMinLabelBounds().bottom-(H.getEdgeOffset(H.get("styles").majorTicks.count,E)*0.5));}}return J;},_redraw:function(){if(this._drawing){this._callLater=true;return;}this._drawing=true;this._callLater=false;var Q=this.get("width"),aa=this.get("height"),Y=0,I=0,ae=0,E=0,D=this.get("leftAxesCollection"),O=this.get("rightAxesCollection"),P=this.get("topAxesCollection"),ad=this.get("bottomAxesCollection"),Z=0,W,J,G="visible",H=this.get("graph"),L,R,X,V,M,N,ac,ab,U=this.get("allowContentOverflow"),S,F,ag,T,K,af={};if(D){ag=[];W=D.length;for(Z=W-1;Z>-1;--Z){ag.unshift(Y);Y+=D[Z].get("width");}}if(O){F=[];W=O.length;Z=0;for(Z=W-1;Z>-1;--Z){I+=O[Z].get("width");F.unshift(Q-I);}}if(P){T=[];W=P.length;for(Z=W-1;Z>-1;--Z){T.unshift(ae);ae+=P[Z].get("height");}}if(ad){K=[];W=ad.length;for(Z=W-1;Z>-1;--Z){E+=ad[Z].get("height");K.unshift(aa-E);}}M=Q-(Y+I);N=aa-(E+ae);af.left=Y;af.top=ae;af.bottom=aa-E;af.right=Q-I;if(!U){L=this._getTopOverflow(D,O);R=this._getBottomOverflow(D,O);X=this._getLeftOverflow(ad,P);V=this._getRightOverflow(ad,P);S=L-ae;if(S>0){af.top=L;if(T){Z=0;W=T.length;for(;Z<W;++Z){T[Z]+=S;}}}S=R-E;if(S>0){af.bottom=aa-R;if(K){Z=0;W=K.length;for(;Z<W;++Z){K[Z]-=S;}}}S=X-Y;if(S>0){af.left=X;if(ag){Z=0;W=ag.length;for(;Z<W;++Z){ag[Z]+=S;}}}S=V-I;if(S>0){af.right=Q-V;if(F){Z=0;W=F.length;for(;Z<W;++Z){F[Z]-=S;}}}}M=af.right-af.left;N=af.bottom-af.top;ac=af.left;ab=af.top;if(P){W=P.length;Z=0;for(;Z<W;Z++){J=P[Z];if(J.get("width")!==M){J.set("width",M);}J.get("boundingBox").setStyle("left",ac+"px");J.get("boundingBox").setStyle("top",T[Z]+"px");}if(J._hasDataOverflow()){G="hidden";}}if(ad){W=ad.length;Z=0;for(;Z<W;Z++){J=ad[Z];if(J.get("width")!==M){J.set("width",M);}J.get("boundingBox").setStyle("left",ac+"px");J.get("boundingBox").setStyle("top",K[Z]+"px");}if(J._hasDataOverflow()){G="hidden";}}if(D){W=D.length;Z=0;for(;Z<W;++Z){J=D[Z];J.get("boundingBox").setStyle("top",ab+"px");J.get("boundingBox").setStyle("left",ag[Z]+"px");if(J.get("height")!==N){J.set("height",N);}}if(J._hasDataOverflow()){G="hidden";}}if(O){W=O.length;Z=0;for(;Z<W;++Z){J=O[Z];J.get("boundingBox").setStyle("top",ab+"px");J.get("boundingBox").setStyle("left",F[Z]+"px");if(J.get("height")!==N){J.set("height",N);}}if(J._hasDataOverflow()){G="hidden";}}this._drawing=false;if(this._callLater){this._redraw();return;}if(H){H.get("boundingBox").setStyle("left",ac+"px");H.get("boundingBox").setStyle("top",ab+"px");H.set("width",M);H.set("height",N);H.get("boundingBox").setStyle("overflow",G);}if(this._overlay){this._overlay.setStyle("left",ac+"px");this._overlay.setStyle("top",ab+"px");this._overlay.setStyle("width",M+"px");this._overlay.setStyle("height",N+"px");}},destructor:function(){var H=this.get("graph"),F=0,D,I=this.get("seriesCollection"),E=this._axesCollection,G=this.get("tooltip").node;if(this._description){this._description.empty();this._description.remove(true);}if(this._liveRegion){this._liveRegion.empty();this._liveRegion.remove(true);}D=I?I.length:0;for(;F<D;++F){if(I[F] instanceof b.CartesianSeries){I[F].destroy(true);}}D=E?E.length:0;for(F=0;F<D;++F){if(E[F] instanceof b.Axis){E[F].destroy(true);}}if(H){H.destroy(true);}if(G){G.empty();G.remove(true);}if(this._overlay){this._overlay.empty();this._overlay.remove(true);}},_getAriaMessage:function(N){var G="",J,M,F,L,I=this._seriesIndex,D=this._itemIndex,H=this.get("seriesCollection"),K=H.length,E;if(N%2===0){if(K>1){if(N===38){I=I<1?K-1:I-1;}else{if(N===40){I=I>=K-1?0:I+1;}}this._itemIndex=-1;}else{I=0;}this._seriesIndex=I;J=this.getSeries(parseInt(I,10));G=J.get("valueDisplayName")+" series.";}else{if(I>-1){G="";J=this.getSeries(parseInt(I,10));}else{I=0;this._seriesIndex=I;J=this.getSeries(parseInt(I,10));
26 G=J.get("valueDisplayName")+" series.";}E=J._dataLength?J._dataLength:0;if(N===37){D=D>0?D-1:E-1;}else{if(N===39){D=D>=E-1?0:D+1;}}this._itemIndex=D;M=this.getSeriesItems(J,D);F=M.category;L=M.value;if(F&&L&&F.value&&L.value){G+=F.displayName+": "+F.axis.formatLabel.apply(this,[F.value,F.axis.get("labelFormat")])+", ";G+=L.displayName+": "+L.axis.formatLabel.apply(this,[L.value,L.axis.get("labelFormat")])+", ";}else{G+="No data available.";}G+=(D+1)+" of "+E+". ";}return G;}},{ATTRS:{allowContentOverflow:{value:false},axesStyles:{getter:function(){var F=this.get("axes"),D,E=this._axesStyles;if(F){for(D in F){if(F.hasOwnProperty(D)&&F[D] instanceof b.Axis){if(!E){E={};}E[D]=F[D].get("styles");}}}return E;},setter:function(F){var E=this.get("axes"),D;for(D in F){if(F.hasOwnProperty(D)&&E.hasOwnProperty(D)){this._setBaseAttribute(E[D],"styles",F[D]);}}}},seriesStyles:{getter:function(){var E=this._seriesStyles,F=this.get("graph"),G,D;if(F){G=F.get("seriesDictionary");if(G){E={};for(D in G){if(G.hasOwnProperty(D)){E[D]=G[D].get("styles");}}}}return E;},setter:function(G){var E,D,F;if(q.isArray(G)){F=this.get("seriesCollection");E=0;D=G.length;for(;E<D;++E){this._setBaseAttribute(F[E],"styles",G[E]);}}else{for(E in G){if(G.hasOwnProperty(E)){F=this.getSeries(E);this._setBaseAttribute(F,"styles",G[E]);}}}}},graphStyles:{getter:function(){var D=this.get("graph");if(D){return(D.get("styles"));}return this._graphStyles;},setter:function(E){var D=this.get("graph");this._setBaseAttribute(D,"styles",E);}},styles:{getter:function(){var D={axes:this.get("axesStyles"),series:this.get("seriesStyles"),graph:this.get("graphStyles")};return D;},setter:function(D){if(D.hasOwnProperty("axes")){if(this.get("axesStyles")){this.set("axesStyles",D.axes);}else{this._axesStyles=D.axes;}}if(D.hasOwnProperty("series")){if(this.get("seriesStyles")){this.set("seriesStyles",D.series);}else{this._seriesStyles=D.series;}}if(D.hasOwnProperty("graph")){this.set("graphStyles",D.graph);}}},axes:{valueFn:"_getDefaultAxes",setter:function(D){return this._setAxes(D);}},seriesCollection:{valueFn:"_getDefaultSeriesCollection",setter:function(D){return this._parseSeriesCollection(D);}},leftAxesCollection:{},bottomAxesCollection:{},rightAxesCollection:{},topAxesCollection:{},stacked:{value:false},direction:{getter:function(){var D=this.get("type");if(D=="bar"){return"vertical";}else{if(D=="column"){return"horizontal";}}return this._direction;},setter:function(D){this._direction=D;return this._direction;}},showAreaFill:{},showMarkers:{},showLines:{},categoryAxisName:{},valueAxisName:{value:"values"},horizontalGridlines:{getter:function(){var D=this.get("graph");if(D){return D.get("horizontalGridlines");}return this._horizontalGridlines;},setter:function(E){var D=this.get("graph");if(E&&!q.isObject(E)){E={};}if(D){D.set("horizontalGridlines",E);}else{this._horizontalGridlines=E;}}},verticalGridlines:{getter:function(){var D=this.get("graph");if(D){return D.get("verticalGridlines");}return this._verticalGridlines;},setter:function(E){var D=this.get("graph");if(E&&!q.isObject(E)){E={};}if(D){D.set("verticalGridlines",E);}else{this._verticalGridlines=E;}}},type:{getter:function(){if(this.get("stacked")){return"stacked"+this._type;}return this._type;},setter:function(D){if(this._type=="bar"){if(D!="bar"){this.set("direction","horizontal");}}else{if(D=="bar"){this.set("direction","vertical");}}this._type=D;return this._type;}},categoryAxis:{}}});b.PieChart=b.Base.create("pieChart",b.Widget,[b.ChartBase],{_getSeriesCollection:function(){if(this._seriesCollection){return this._seriesCollection;}var I=this.get("axes"),K=[],J,G=0,F,L=this.get("type"),N,D="categoryAxis",H="categoryKey",E="valueAxis",M="valueKey";if(I){J=I.values.get("keyCollection");N=I.category.get("keyCollection")[0];F=J.length;for(;G<F;++G){K[G]={type:L};K[G][D]="category";K[G][E]="values";K[G][H]=N;K[G][M]=J[G];}}this._seriesCollection=K;return K;},_parseAxes:function(G){if(!this._axes){this._axes={};}var H,M,F,K,D,J,L=this.get("type"),N=this.get("width"),I=this.get("height"),E=b.Node.one(this._parentNode);if(!N){this.set("width",E.get("offsetWidth"));N=this.get("width");}if(!I){this.set("height",E.get("offsetHeight"));I=this.get("height");}for(H in G){if(G.hasOwnProperty(H)){K=G[H];M=L=="pie"?"none":K.position;J=this._getAxisClass(K.type);D={dataProvider:this.get("dataProvider")};if(K.hasOwnProperty("roundingUnit")){D.roundingUnit=K.roundingUnit;}D.keys=K.keys;D.width=N;D.height=I;D.position=M;D.styles=K.styles;F=new J(D);F.on("axisRendered",b.bind(this._itemRendered,this));this._axes[H]=F;}}},_addAxes:function(){var G=this.get("axes"),D,E,F;if(!G){this.set("axes",this._getDefaultAxes());G=this.get("axes");}if(!this._axesCollection){this._axesCollection=[];}for(D in G){if(G.hasOwnProperty(D)){E=G[D];F=E.get("position");if(!this.get(F+"AxesCollection")){this.set(F+"AxesCollection",[E]);}else{this.get(F+"AxesCollection").push(E);}this._axesCollection.push(E);}}},_addSeries:function(){var D=this.get("graph"),E=this.get("seriesCollection");this._parseSeriesAxes(E);D.set("showBackground",false);D.set("width",this.get("width"));D.set("height",this.get("height"));D.set("seriesCollection",E);this._seriesCollection=D.get("seriesCollection");D.render(this.get("contentBox"));},_parseSeriesAxes:function(I){var E=0,D=I.length,G,H=this.get("axes"),F;for(;E<D;++E){G=I[E];if(G){if(G instanceof b.PieSeries){F=G.get("categoryAxis");if(F&&!(F instanceof b.Axis)){G.set("categoryAxis",H[F]);}F=G.get("valueAxis");if(F&&!(F instanceof b.Axis)){G.set("valueAxis",H[F]);}continue;}G.categoryAxis=H.category;G.valueAxis=H.values;if(!G.type){G.type=this.get("type");}}}},_getDefaultAxes:function(){var H=this.get("categoryKey"),E=this.get("seriesKeys")||[],D="numeric",G,F=this.get("dataProvider")[0];if(E.length<1){for(G in F){if(G!=H){E.push(G);}}if(E.length>0){this.set("seriesKeys",E);}}return{values:{keys:E,type:D},category:{keys:[H],type:this.get("categoryType")}};},getSeriesItems:function(F,E){var G={axis:F.get("categoryAxis"),key:F.get("categoryKey"),displayName:F.get("categoryDisplayName")},D={axis:F.get("valueAxis"),key:F.get("valueKey"),displayName:F.get("valueDisplayName")};
27 G.value=G.axis.getKeyValueAt(G.key,E);D.value=D.axis.getKeyValueAt(D.key,E);return{category:G,value:D};},_sizeChanged:function(D){this._redraw();},_redraw:function(){var F=this.get("graph"),D=this.get("width"),E=this.get("height"),G;if(F){G=Math.min(D,E);F.set("width",G);F.set("height",G);}},_tooltipLabelFunction:function(K,D,G,F,E){var J=g.createElement("div"),H=F.getTotalValues(),I=Math.round((D.value/H)*10000)/100;J.appendChild(g.createTextNode(K.displayName+": "+K.axis.get("labelFunction").apply(this,[K.value,K.axis.get("labelFormat")])));J.appendChild(g.createElement("br"));J.appendChild(g.createTextNode(D.displayName+": "+D.axis.get("labelFunction").apply(this,[D.value,D.axis.get("labelFormat")])));J.appendChild(g.createElement("br"));J.appendChild(g.createTextNode(I+"%"));return J;},_getAriaMessage:function(P){var F="",E,M,J,L,I=0,D=this._itemIndex,G=this.get("seriesCollection"),K,N,O,H;J=this.getSeries(parseInt(I,10));H=J.get("markers");K=H&&H.length?H.length:0;if(P===37){D=D>0?D-1:K-1;}else{if(P===39){D=D>=K-1?0:D+1;}}this._itemIndex=D;M=this.getSeriesItems(J,D);E=M.category;L=M.value;N=J.getTotalValues();O=Math.round((L.value/N)*10000)/100;if(E&&L){F+=E.displayName+": "+E.axis.formatLabel.apply(this,[E.value,E.axis.get("labelFormat")])+", ";F+=L.displayName+": "+L.axis.formatLabel.apply(this,[L.value,L.axis.get("labelFormat")])+", ";F+="Percent of total "+L.displayName+": "+O+"%,";}else{F+="No data available,";}F+=(D+1)+" of "+K+". ";return F;}},{ATTRS:{ariaDescription:{value:"Use the left and right keys to navigate through items.",setter:function(D){if(this._description){this._description.setContent("");this._description.appendChild(g.createTextNode(D));}return D;}},axes:{getter:function(){return this._axes;},setter:function(D){this._parseAxes(D);}},seriesCollection:{getter:function(){return this._getSeriesCollection();},setter:function(D){return this._setSeriesCollection(D);}},type:{value:"pie"}}});},"3.5.1",{requires:["dom","datatype-number","datatype-date","event-custom","event-mouseenter","event-touch","widget","widget-position","widget-stack","graphics"]});