]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/yui3/build/charts/charts.js
Release 6.2.2
[Github/sugarcrm.git] / include / javascript / yui3 / build / charts / charts.js
1 /*
2  Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3  Code licensed under the BSD License:
4  http://developer.yahoo.com/yui/license.html
5  version: 3.3.0
6  build: 3167
7  */
8 YUI.add('charts',function(Y){var ISCHROME=Y.UA.chrome,DRAWINGAPI,canvas=document.createElement("canvas");if(document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"))
9 {DRAWINGAPI="svg";}
10 else if(canvas&&canvas.getContext&&canvas.getContext("2d"))
11 {DRAWINGAPI="canvas";}
12 else
13 {DRAWINGAPI="vml";}
14 var Graphic=function(config){this.initializer.apply(this,arguments);};Graphic.prototype={autoSize:true,initializer:function(config){config=config||{};var w=config.width||0,h=config.height||0;if(config.node)
15 {this.node=config.node;this._styleGroup(this.node);}
16 else
17 {this.node=this._createGraphics();this.setSize(w,h);}
18 this._initProps();},beginBitmapFill:function(config){var fill={};fill.src=config.bitmap.src;fill.type="tile";this._fillProps=fill;if(!isNaN(config.tx)||!isNaN(config.ty)||!isNaN(config.width)||!isNaN(config.height))
19 {this._gradientBox={tx:config.tx,ty:config.ty,width:config.width,height:config.height};}
20 else
21 {this._gradientBox=null;}},beginFill:function(color,alpha){if(color){this._fillAlpha=Y.Lang.isNumber(alpha)?alpha:1;this._fillColor=color;this._fillType='solid';this._fill=1;}
22 return this;},beginGradientFill:function(config){var alphas=config.alphas||[];if(!this._defs)
23 {this._defs=this._createGraphicNode("defs");this.node.appendChild(this._defs);}
24 this._fillAlphas=alphas;this._fillColors=config.colors;this._fillType=config.type||"linear";this._fillRatios=config.ratios||[];this._fillRotation=config.rotation||0;this._fillWidth=config.width||null;this._fillHeight=config.height||null;this._fillX=!isNaN(config.tx)?config.tx:NaN;this._fillY=!isNaN(config.ty)?config.ty:NaN;this._gradientId="lg"+Math.round(100000*Math.random());return this;},destroy:function()
25 {this._removeChildren(this.node);if(this.node&&this.node.parentNode)
26 {this.node.parentNode.removeChild(this.node);}},_removeChildren:function(node)
27 {if(node.hasChildNodes())
28 {var child;while(node.firstChild)
29 {child=node.firstChild;this._removeChildren(child);node.removeChild(child);}}},toggleVisible:function(val)
30 {this._toggleVisible(this.node,val);},_toggleVisible:function(node,val)
31 {var children=Y.Selector.query(">/*",node),visibility=val?"visible":"hidden",i=0,len;if(children)
32 {len=children.length;for(;i<len;++i)
33 {this._toggleVisible(children[i],val);}}
34 node.style.visibility=visibility;},clear:function(){if(this._graphicsList)
35 {while(this._graphicsList.length>0)
36 {this.node.removeChild(this._graphicsList.shift());}}
37 this.path='';},curveTo:function(cp1x,cp1y,cp2x,cp2y,x,y){this._shapeType="path";if(this.path.indexOf("C")<0||this._pathType!=="C")
38 {this._pathType="C";this.path+=' C';}
39 this.path+=Math.round(cp1x)+", "+Math.round(cp1y)+", "+Math.round(cp2x)+", "+Math.round(cp2y)+", "+x+", "+y+" ";this._trackSize(x,y);},quadraticCurveTo:function(cpx,cpy,x,y){if(this.path.indexOf("Q")<0||this._pathType!=="Q")
40 {this._pathType="Q";this.path+=" Q";}
41 this.path+=Math.round(cpx)+" "+Math.round(cpy)+" "+Math.round(x)+" "+Math.round(y);},drawCircle:function(x,y,r){this._shape={x:x-r,y:y-r,w:r*2,h:r*2};this._attributes={cx:x,cy:y,r:r};this._width=this._height=r*2;this._x=x-r;this._y=y-r;this._shapeType="circle";this._draw();},drawEllipse:function(x,y,w,h){this._shape={x:x,y:y,w:w,h:h};this._width=w;this._height=h;this._x=x;this._y=y;this._shapeType="ellipse";this._draw();},drawRect:function(x,y,w,h){this._shape={x:x,y:y,w:w,h:h};this._x=x;this._y=y;this._width=w;this._height=h;this.moveTo(x,y);this.lineTo(x+w,y);this.lineTo(x+w,y+h);this.lineTo(x,y+h);this.lineTo(x,y);this._draw();},drawRoundRect:function(x,y,w,h,ew,eh){this._shape={x:x,y:y,w:w,h:h};this._x=x;this._y=y;this._width=w;this._height=h;this.moveTo(x,y+eh);this.lineTo(x,y+h-eh);this.quadraticCurveTo(x,y+h,x+ew,y+h);this.lineTo(x+w-ew,y+h);this.quadraticCurveTo(x+w,y+h,x+w,y+h-eh);this.lineTo(x+w,y+eh);this.quadraticCurveTo(x+w,y,x+w-ew,y);this.lineTo(x+ew,y);this.quadraticCurveTo(x,y,x,y+eh);this._draw();},drawWedge:function(x,y,startAngle,arc,radius,yRadius)
42 {this._drawingComplete=false;this.path=this._getWedgePath({x:x,y:y,startAngle:startAngle,arc:arc,radius:radius,yRadius:yRadius});this._width=radius*2;this._height=this._width;this._shapeType="path";this._draw();},end:function(){if(this._shapeType)
43 {this._draw();}
44 this._initProps();},lineGradientStyle:function(){},lineStyle:function(thickness,color,alpha,pixelHinting,scaleMode,caps,joints,miterLimit){this._stroke=1;this._strokeWeight=thickness;if(color){this._strokeColor=color;}
45 this._strokeAlpha=Y.Lang.isNumber(alpha)?alpha:1;},lineTo:function(point1,point2,etc){var args=arguments,i,len;if(typeof point1==='string'||typeof point1==='number'){args=[[point1,point2]];}
46 len=args.length;this._shapeType="path";if(this.path.indexOf("L")<0||this._pathType!=="L")
47 {this._pathType="L";this.path+=' L';}
48 for(i=0;i<len;++i){this.path+=args[i][0]+', '+args[i][1]+" ";this._trackSize.apply(this,args[i]);}},moveTo:function(x,y){this._pathType="M";this.path+=' M'+x+', '+y;},_getWedgePath:function(config)
49 {var x=config.x,y=config.y,startAngle=config.startAngle,arc=config.arc,radius=config.radius,yRadius=config.yRadius||radius,segs,segAngle,theta,angle,angleMid,ax,ay,bx,by,cx,cy,i=0,path=' M'+x+', '+y;if(Math.abs(arc)>360)
50 {arc=360;}
51 segs=Math.ceil(Math.abs(arc)/ 45);segAngle=arc / segs;theta=-(segAngle / 180)*Math.PI;angle=(startAngle / 180)*Math.PI;if(segs>0)
52 {ax=x+Math.cos(startAngle / 180*Math.PI)*radius;ay=y+Math.sin(startAngle / 180*Math.PI)*yRadius;path+=" L"+Math.round(ax)+", "+Math.round(ay);path+=" Q";for(;i<segs;++i)
53 {angle+=theta;angleMid=angle-(theta / 2);bx=x+Math.cos(angle)*radius;by=y+Math.sin(angle)*yRadius;cx=x+Math.cos(angleMid)*(radius / Math.cos(theta / 2));cy=y+Math.sin(angleMid)*(yRadius / Math.cos(theta / 2));path+=Math.round(cx)+" "+Math.round(cy)+" "+Math.round(bx)+" "+Math.round(by)+" ";}
54 path+=' L'+x+", "+y;}
55 return path;},setSize:function(w,h){if(this.autoSize)
56 {if(w>this.node.getAttribute("width"))
57 {this.node.setAttribute("width",w);}
58 if(h>this.node.getAttribute("height"))
59 {this.node.setAttribute("height",h);}}},_trackSize:function(w,h){if(w>this._width){this._width=w;}
60 if(h>this._height){this._height=h;}
61 this.setSize(w,h);},setPosition:function(x,y)
62 {this.node.setAttribute("x",x);this.node.setAttribute("y",y);},render:function(parentNode){var w=parentNode.get("width")||parentNode.get("offsetWidth"),h=parentNode.get("height")||parentNode.get("offsetHeight");parentNode=parentNode||Y.config.doc.body;parentNode.appendChild(this.node);this.setSize(w,h);this._initProps();return this;},_initProps:function(){this._shape=null;this._fillColor=null;this._strokeColor=null;this._strokeWeight=0;this._fillProps=null;this._fillAlphas=null;this._fillColors=null;this._fillType=null;this._fillRatios=null;this._fillRotation=null;this._fillWidth=null;this._fillHeight=null;this._fillX=NaN;this._fillY=NaN;this.path='';this._width=0;this._height=0;this._x=0;this._y=0;this._fill=null;this._stroke=0;this._stroked=false;this._pathType=null;this._attributes={};},_clearPath:function()
63 {this._shape=null;this._shapeType=null;this.path='';this._width=0;this._height=0;this._x=0;this._y=0;this._pathType=null;this._attributes={};},_draw:function()
64 {var shape=this._createGraphicNode(this._shapeType),i,gradFill;if(this.path)
65 {if(this._fill)
66 {this.path+='z';}
67 shape.setAttribute("d",this.path);}
68 else
69 {for(i in this._attributes)
70 {if(this._attributes.hasOwnProperty(i))
71 {shape.setAttribute(i,this._attributes[i]);}}}
72 shape.setAttribute("stroke-width",this._strokeWeight);if(this._strokeColor)
73 {shape.setAttribute("stroke",this._strokeColor);shape.setAttribute("stroke-opacity",this._strokeAlpha);}
74 if(!this._fillType||this._fillType==="solid")
75 {if(this._fillColor)
76 {shape.setAttribute("fill",this._fillColor);shape.setAttribute("fill-opacity",this._fillAlpha);}
77 else
78 {shape.setAttribute("fill","none");}}
79 else if(this._fillType==="linear")
80 {gradFill=this._getFill();gradFill.setAttribute("id",this._gradientId);this._defs.appendChild(gradFill);shape.setAttribute("fill","url(#"+this._gradientId+")");}
81 this.node.appendChild(shape);this._clearPath();},_getFill:function(){var type=this._fillType,fill;switch(type){case'linear':fill=this._getLinearGradient('fill');break;case'radial':break;case'bitmap':break;}
82 return fill;},_getLinearGradient:function(type){var fill=this._createGraphicNode("linearGradient"),prop='_'+type,colors=this[prop+'Colors'],ratios=this[prop+'Ratios'],alphas=this[prop+'Alphas'],w=this._fillWidth||(this._shape.w),h=this._fillHeight||(this._shape.h),r=this[prop+'Rotation'],i,l,color,ratio,alpha,def,stop,x1,x2,y1,y2,cx=w/2,cy=h/2,radCon,tanRadians;radCon=Math.PI/180;tanRadians=parseFloat(parseFloat(Math.tan(r*radCon)).toFixed(8));if(Math.abs(tanRadians)*w/2>=h/2)
83 {if(r<180)
84 {y1=0;y2=h;}
85 else
86 {y1=h;y2=0;}
87 x1=cx-((cy-y1)/tanRadians);x2=cx-((cy-y2)/tanRadians);}
88 else
89 {if(r>90&&r<270)
90 {x1=w;x2=0;}
91 else
92 {x1=0;x2=w;}
93 y1=((tanRadians*(cx-x1))-cy)*-1;y2=((tanRadians*(cx-x2))-cy)*-1;}
94 fill.setAttribute("gradientTransform","rotate("+r+")");fill.setAttribute("width",w);fill.setAttribute("height",h);fill.setAttribute("gradientUnits","userSpaceOnUse");l=colors.length;def=0;for(i=0;i<l;++i)
95 {alpha=alphas[i];color=colors[i];ratio=ratios[i]||i/(l-1);ratio=Math.round(ratio*100)+"%";alpha=Y.Lang.isNumber(alpha)?alpha:"1";def=(i+1)/ l;stop=this._createGraphicNode("stop");stop.setAttribute("offset",ratio);stop.setAttribute("stop-color",color);stop.setAttribute("stop-opacity",alpha);fill.appendChild(stop);}
96 return fill;},_createGraphics:function(){var group=this._createGraphicNode("svg");this._styleGroup(group);return group;},_styleGroup:function(group)
97 {group.style.position="absolute";group.style.top="0px";group.style.overflow="visible";group.style.left="0px";group.setAttribute("pointer-events","none");},_createGraphicNode:function(type,pe)
98 {var node=document.createElementNS("http://www.w3.org/2000/svg","svg:"+type),v=pe||"none";if(type!=="defs"&&type!=="stop"&&type!=="linearGradient")
99 {node.setAttribute("pointer-events",v);}
100 if(type!="svg")
101 {if(!this._graphicsList)
102 {this._graphicsList=[];}
103 this._graphicsList.push(node);}
104 return node;},getShape:function(config){config.graphic=this;return new Y.Shape(config);}};Y.Graphic=Graphic;function CanvasDrawingUtil()
105 {this.initializer.apply(this,arguments);}
106 CanvasDrawingUtil.prototype={initializer:function(config){this._dummy=this._createDummy();this._canvas=this._createGraphic();this._context=this._canvas.getContext('2d');this._initProps();},beginBitmapFill:function(config){var context=this._context,bitmap=config.bitmap,repeat=config.repeat||'repeat';this._fillWidth=config.width||null;this._fillHeight=config.height||null;this._fillX=!isNaN(config.tx)?config.tx:NaN;this._fillY=!isNaN(config.ty)?config.ty:NaN;this._fillType='bitmap';this._bitmapFill=context.createPattern(bitmap,repeat);return this;},beginFill:function(color,alpha){var context=this._context;context.beginPath();if(color){if(alpha){color=this._2RGBA(color,alpha);}else{color=this._2RGB(color);}
107 this._fillColor=color;this._fillType='solid';}
108 return this;},beginGradientFill:function(config){var color,alpha,i=0,colors=config.colors,alphas=config.alphas||[],len=colors.length;this._fillAlphas=alphas;this._fillColors=colors;this._fillType=config.type||"linear";this._fillRatios=config.ratios||[];this._fillRotation=config.rotation||0;this._fillWidth=config.width||null;this._fillHeight=config.height||null;this._fillX=!isNaN(config.tx)?config.tx:NaN;this._fillY=!isNaN(config.ty)?config.ty:NaN;for(;i<len;++i)
109 {alpha=alphas[i];color=colors[i];if(alpha){color=this._2RGBA(color,alpha);}else{color=this._2RGB(color);}
110 colors[i]=color;}
111 this._context.beginPath();return this;},lineStyle:function(thickness,color,alpha,pixelHinting,scaleMode,caps,joints,miterLimit){color=color||'#000000';var context=this._context;if(this._stroke)
112 {context.stroke();}
113 context.lineWidth=thickness;if(thickness){this._stroke=1;}else{this._stroke=0;}
114 if(color){this._strokeStyle=color;if(alpha){this._strokeStyle=this._2RGBA(this._strokeStyle,alpha);}}
115 if(!this._fill)
116 {context.beginPath();}
117 if(caps==='butt'){caps='none';}
118 if(context.lineCap){}
119 this._drawingComplete=false;return this;},lineTo:function(point1,point2,etc){var args=arguments,context=this._context,i,len;if(typeof point1==='string'||typeof point1==='number'){args=[[point1,point2]];}
120 for(i=0,len=args.length;i<len;++i){context.lineTo(args[i][0],args[i][1]);this._updateShapeProps.apply(this,args[i]);this._trackSize.apply(this,args[i]);}
121 this._drawingComplete=false;return this;},moveTo:function(x,y){this._context.moveTo(x,y);this._trackPos(x,y);this._updateShapeProps(x,y);this._drawingComplete=false;return this;},clear:function(){this._initProps();this._canvas.width=this._canvas.width;this._canvas.height=this._canvas.height;return this;},curveTo:function(cp1x,cp1y,cp2x,cp2y,x,y){this._context.bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y);this._drawingComplete=false;this._updateShapeProps(x,y);this._trackSize(x,y);this._trackPos(x,y);return this;},quadraticCurveTo:function(controlX,controlY,anchorX,anchorY){this._context.quadraticCurveTo(controlX,controlY,anchorX,anchorY);this._drawingComplete=false;this._updateShapeProps(anchorX,anchorY);return this;},drawCircle:function(x,y,radius){var context=this._context,startAngle=0,endAngle=2*Math.PI;this._shape={x:x-radius,y:y-radius,w:radius*2,h:radius*2};this._drawingComplete=false;this._trackPos(x,y);this._trackSize(radius*2,radius*2);context.beginPath();context.arc(x,y,radius,startAngle,endAngle,false);this._draw();return this;},drawEllipse:function(x,y,w,h){this._shape={x:x,y:y,w:w,h:h};if(this._stroke&&this._context.lineWidth>0)
122 {w-=this._context.lineWidth*2;h-=this._context.lineWidth*2;x+=this._context.lineWidth;y+=this._context.lineWidth;}
123 var context=this._context,l=8,theta=-(45/180)*Math.PI,angle=0,angleMid,radius=w/2,yRadius=h/2,i=0,centerX=x+radius,centerY=y+yRadius,ax,ay,bx,by,cx,cy;this._drawingComplete=false;this._trackPos(x,y);this._trackSize(x+w,y+h);context.beginPath();ax=centerX+Math.cos(0)*radius;ay=centerY+Math.sin(0)*yRadius;context.moveTo(ax,ay);for(;i<l;i++)
124 {angle+=theta;angleMid=angle-(theta / 2);bx=centerX+Math.cos(angle)*radius;by=centerY+Math.sin(angle)*yRadius;cx=centerX+Math.cos(angleMid)*(radius / Math.cos(theta / 2));cy=centerY+Math.sin(angleMid)*(yRadius / Math.cos(theta / 2));context.quadraticCurveTo(cx,cy,bx,by);}
125 this._draw();return this;},drawRect:function(x,y,w,h){var ctx=this._context;this._shape={x:x,y:y,w:w,h:h};this._drawingComplete=false;ctx.beginPath();ctx.moveTo(x,y);ctx.lineTo(x+w,y);ctx.lineTo(x+w,y+h);ctx.lineTo(x,y+h);ctx.lineTo(x,y);this._trackPos(x,y);this._trackSize(w,h);this._draw();return this;},drawRoundRect:function(x,y,w,h,ew,eh){this._shape={x:x,y:y,w:w,h:h};var ctx=this._context;this._drawingComplete=false;ctx.beginPath();ctx.moveTo(x,y+eh);ctx.lineTo(x,y+h-eh);ctx.quadraticCurveTo(x,y+h,x+ew,y+h);ctx.lineTo(x+w-ew,y+h);ctx.quadraticCurveTo(x+w,y+h,x+w,y+h-eh);ctx.lineTo(x+w,y+eh);ctx.quadraticCurveTo(x+w,y,x+w-ew,y);ctx.lineTo(x+ew,y);ctx.quadraticCurveTo(x,y,x,y+eh);this._trackPos(x,y);this._trackSize(w,h);this._draw();return this;},drawWedge:function(cfg)
126 {var x=cfg.x,y=cfg.y,startAngle=cfg.startAngle,arc=cfg.arc,radius=cfg.radius,yRadius=cfg.yRadius,segs,segAngle,theta,angle,angleMid,ax,ay,bx,by,cx,cy,i=0;this._drawingComplete=false;this.moveTo(x,y);yRadius=yRadius||radius;if(Math.abs(arc)>360)
127 {arc=360;}
128 segs=Math.ceil(Math.abs(arc)/ 45);segAngle=arc / segs;theta=-(segAngle / 180)*Math.PI;angle=(startAngle / 180)*Math.PI;if(segs>0)
129 {ax=x+Math.cos(startAngle / 180*Math.PI)*radius;ay=y+Math.sin(startAngle / 180*Math.PI)*yRadius;this.lineTo(ax,ay);for(;i<segs;++i)
130 {angle+=theta;angleMid=angle-(theta / 2);bx=x+Math.cos(angle)*radius;by=y+Math.sin(angle)*yRadius;cx=x+Math.cos(angleMid)*(radius / Math.cos(theta / 2));cy=y+Math.sin(angleMid)*(yRadius / Math.cos(theta / 2));this.quadraticCurveTo(cx,cy,bx,by);}
131 this.lineTo(x,y);}
132 this._trackPos(x,y);this._trackSize(radius,radius);this._draw();},end:function(){this._draw();this._initProps();return this;},lineGradientStyle:function(){return this;},setSize:function(w,h)
133 {this._canvas.width=w;this._canvas.height=h;},_initProps:function(){var context=this._context;context.fillStyle='rgba(0, 0, 0, 1)';context.lineWidth=1;context.lineJoin='miter';context.miterLimit=3;this._strokeStyle='rgba(0, 0, 0, 1)';this._width=0;this._height=0;this._x=0;this._y=0;this._fillType=null;this._stroke=null;this._bitmapFill=null;this._drawingComplete=false;},_getFill:function(){var type=this._fillType,fill;switch(type){case'linear':fill=this._getLinearGradient('fill');break;case'radial':fill=this._getRadialGradient('fill');break;case'bitmap':fill=this._bitmapFill;break;case'solid':fill=this._fillColor;break;}
134 return fill;},_getLinearGradient:function(type){var prop='_'+type,colors=this[prop+'Colors'],ratios=this[prop+'Ratios'],x=!isNaN(this._fillX)?this._fillX:this._shape.x,y=!isNaN(this._fillY)?this._fillY:this._shape.y,w=this._fillWidth||(this._shape.w),h=this._fillHeight||(this._shape.h),ctx=this._context,r=this[prop+'Rotation'],i,l,color,ratio,def,grad,x1,x2,y1,y2,cx=x+w/2,cy=y+h/2,radCon=Math.PI/180,tanRadians=parseFloat(parseFloat(Math.tan(r*radCon)).toFixed(8));if(Math.abs(tanRadians)*w/2>=h/2)
135 {if(r<180)
136 {y1=y;y2=y+h;}
137 else
138 {y1=y+h;y2=y;}
139 x1=cx-((cy-y1)/tanRadians);x2=cx-((cy-y2)/tanRadians);}
140 else
141 {if(r>90&&r<270)
142 {x1=x+w;x2=x;}
143 else
144 {x1=x;x2=x+w;}
145 y1=((tanRadians*(cx-x1))-cy)*-1;y2=((tanRadians*(cx-x2))-cy)*-1;}
146 grad=ctx.createLinearGradient(x1,y1,x2,y2);l=colors.length;def=0;for(i=0;i<l;++i)
147 {color=colors[i];ratio=ratios[i]||i/(l-1);grad.addColorStop(ratio,color);def=(i+1)/ l;}
148 return grad;},_getRadialGradient:function(type){var prop='_'+type,colors=this[prop+"Colors"],ratios=this[prop+"Ratios"],i,l,w=this._fillWidth||this._shape.w,h=this._fillHeight||this._shape.h,x=!isNaN(this._fillX)?this._fillX:this._shape.x,y=!isNaN(this._fillY)?this._fillY:this._shape.y,color,ratio,def,grad,ctx=this._context;x+=w/2;y+=h/2;grad=ctx.createRadialGradient(x,y,1,x,y,w/2);l=colors.length;def=0;for(i=0;i<l;++i){color=colors[i];ratio=ratios[i]||i/(l-1);grad.addColorStop(ratio,color);}
149 return grad;},_draw:function()
150 {if(this._drawingComplete||!this._shape)
151 {return;}
152 var context=this._context,fill;if(this._fillType){fill=this._getFill();if(fill){context.fillStyle=fill;}
153 context.closePath();}
154 if(this._fillType){context.fill();}
155 if(this._stroke){context.strokeStyle=this._strokeStyle;context.stroke();}
156 this._drawingComplete=true;},_drawingComplete:false,_reHex:/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,_2RGBA:function(val,alpha){alpha=(alpha!==undefined)?alpha:1;if(this._reHex.exec(val)){val='rgba('+[parseInt(RegExp.$1,16),parseInt(RegExp.$2,16),parseInt(RegExp.$3,16)].join(',')+','+alpha+')';}
157 return val;},_createDummy:function(){var dummy=Y.config.doc.createElement('div');dummy.style.height=0;dummy.style.width=0;dummy.style.overflow='hidden';Y.config.doc.documentElement.appendChild(dummy);return dummy;},_createGraphic:function(config){var graphic=Y.config.doc.createElement('canvas');graphic.width=600;graphic.height=600;return graphic;},_2RGB:function(val){this._dummy.style.background=val;return this._dummy.style.backgroundColor;},_trackSize:function(w,h){if(w>this._width){this._width=w;}
158 if(h>this._height){this._height=h;}},_trackPos:function(x,y){if(x>this._x){this._x=x;}
159 if(y>this._y){this._y=y;}},_updateShapeProps:function(x,y)
160 {var w,h;if(!this._shape)
161 {this._shape={};}
162 if(!this._shape.x)
163 {this._shape.x=x;}
164 else
165 {this._shape.x=Math.min(this._shape.x,x);}
166 if(!this._shape.y)
167 {this._shape.y=y;}
168 else
169 {this._shape.y=Math.min(this._shape.y,y);}
170 w=Math.abs(x-this._shape.x);if(!this._shape.w)
171 {this._shape.w=w;}
172 else
173 {this._shape.w=Math.max(w,this._shape.w);}
174 h=Math.abs(y-this._shape.y);if(!this._shape.h)
175 {this._shape.h=h;}
176 else
177 {this._shape.h=Math.max(h,this._shape.h);}},getShape:function(config){config.graphic=this;return new Y.Shape(config);}};Y.CanvasDrawingUtil=CanvasDrawingUtil;Y.CanvasGraphic=Y.Base.create("graphic",Y.CanvasDrawingUtil,[],{autoSize:true,setSize:function(w,h){if(this.autoSize)
178 {if(w>this.node.getAttribute("width"))
179 {this.node.style.width=w+"px";this._canvas.style.width=w+"px";this._canvas.width=w;this.node.setAttribute("width",w);}
180 if(h>this.node.getAttribute("height"))
181 {this.node.style.height=h+"px";this._canvas.style.height=h+"px";this._canvas.height=h;this.node.setAttribute("height",h);}}},_trackSize:function(w,h){if(w>this._width){this._width=w;}
182 if(h>this._height){this._height=h;}
183 this.setSize(w,h);},setPosition:function(x,y)
184 {this.node.style.left=x+"px";this.node.style.top=y+"px";},render:function(node){node=node||Y.config.doc.body;this.node=document.createElement("div");this.node.style.width=node.offsetWidth+"px";this.node.style.height=node.offsetHeight+"px";this.node.style.display="block";this.node.style.position="absolute";this.node.style.left=node.getStyle("left");this.node.style.top=node.getStyle("top");this.node.style.pointerEvents="none";node.appendChild(this.node);this.node.appendChild(this._canvas);this._canvas.width=node.offsetWidth>0?node.offsetWidth:100;this._canvas.height=node.offsetHeight>0?node.offsetHeight:100;this._canvas.style.position="absolute";return this;},toggleVisible:function(val)
185 {this.node.style.visibility=val?"visible":"hidden";},_createGraphicNode:function(pe)
186 {var node=Y.config.doc.createElement('canvas');node.style.pointerEvents=pe||"none";if(!this._graphicsList)
187 {this._graphicsList=[];}
188 this._graphicsList.push(node);return node;},destroy:function()
189 {this._removeChildren(this.node);if(this.node&&this.node.parentNode)
190 {this.node.parentNode.removeChild(this.node);}},_removeChildren:function(node)
191 {if(node.hasChildNodes())
192 {var child;while(node.firstChild)
193 {child=node.firstChild;this._removeChildren(child);node.removeChild(child);}}},node:null});if(DRAWINGAPI=="canvas")
194 {Y.Graphic=Y.CanvasGraphic;}
195 var VMLGraphics=function(config){this.initializer.apply(this,arguments);};VMLGraphics.prototype={initializer:function(config){config=config||{};var w=config.width||0,h=config.height||0;this.node=this._createGraphics();this.setSize(w,h);this._initProps();},beginBitmapFill:function(config){var fill={};fill.src=config.bitmap.src;fill.type="tile";this._fillProps=fill;if(!isNaN(config.tx)||!isNaN(config.ty)||!isNaN(config.width)||!isNaN(config.height))
196 {this._gradientBox={tx:config.tx,ty:config.ty,width:config.width,height:config.height};}
197 else
198 {this._gradientBox=null;}},beginFill:function(color,alpha){if(color){if(Y.Lang.isNumber(alpha)){this._fillProps={type:"solid",opacity:alpha};}
199 this._fillColor=color;this._fill=1;}
200 return this;},beginGradientFill:function(config){var type=config.type,colors=config.colors,alphas=config.alphas||[],ratios=config.ratios||[],fill={colors:colors,ratios:ratios},len=alphas.length,i=0,alpha,oi,rotation=config.rotation||0;for(;i<len;++i)
201 {alpha=alphas[i];alpha=Y.Lang.isNumber(alpha)?alpha:1;oi=i>0?i+1:"";alphas[i]=Math.round(alpha*100)+"%";fill["opacity"+oi]=alpha;}
202 if(type==="linear")
203 {if(config)
204 {}
205 if(rotation>0&&rotation<=90)
206 {rotation=450-rotation;}
207 else if(rotation<=270)
208 {rotation=270-rotation;}
209 else if(rotation<=360)
210 {rotation=630-rotation;}
211 else
212 {rotation=270;}
213 fill.type="gradientunscaled";fill.angle=rotation;}
214 else if(type==="radial")
215 {fill.alignshape=false;fill.type="gradientradial";fill.focus="100%";fill.focusposition="50%,50%";}
216 fill.ratios=ratios||[];if(!isNaN(config.tx)||!isNaN(config.ty)||!isNaN(config.width)||!isNaN(config.height))
217 {this._gradientBox={tx:config.tx,ty:config.ty,width:config.width,height:config.height};}
218 else
219 {this._gradientBox=null;}
220 this._fillProps=fill;},clear:function(){this._path='';this._removeChildren(this.node);},destroy:function()
221 {this._removeChildren(this.node);this.node.parentNode.removeChild(this.node);},_removeChildren:function(node)
222 {if(node.hasChildNodes())
223 {var child;while(node.firstChild)
224 {child=node.firstChild;this._removeChildren(child);node.removeChild(child);}}},toggleVisible:function(val)
225 {this._toggleVisible(this.node,val);},_toggleVisible:function(node,val)
226 {var children=Y.one(node).get("children"),visibility=val?"visible":"hidden",i=0,len;if(children)
227 {len=children.length;for(;i<len;++i)
228 {this._toggleVisible(children[i],val);}}
229 node.style.visibility=visibility;},curveTo:function(cp1x,cp1y,cp2x,cp2y,x,y){this._shape="shape";this._path+=' c '+Math.round(cp1x)+", "+Math.round(cp1y)+", "+Math.round(cp2x)+", "+Math.round(cp2y)+", "+x+", "+y;this._trackSize(x,y);},quadraticCurveTo:function(cpx,cpy,x,y){this._path+=' qb '+cpx+", "+cpy+", "+x+", "+y;},drawCircle:function(x,y,r){this._width=this._height=r*2;this._x=x-r;this._y=y-r;this._shape="oval";this._draw();},drawEllipse:function(x,y,w,h){this._width=w;this._height=h;this._x=x;this._y=y;this._shape="oval";this._draw();},drawRect:function(x,y,w,h){this._x=x;this._y=y;this._width=w;this._height=h;this.moveTo(x,y);this.lineTo(x+w,y);this.lineTo(x+w,y+h);this.lineTo(x,y+h);this.lineTo(x,y);this._draw();},drawRoundRect:function(x,y,w,h,ew,eh){this._x=x;this._y=y;this._width=w;this._height=h;this.moveTo(x,y+eh);this.lineTo(x,y+h-eh);this.quadraticCurveTo(x,y+h,x+ew,y+h);this.lineTo(x+w-ew,y+h);this.quadraticCurveTo(x+w,y+h,x+w,y+h-eh);this.lineTo(x+w,y+eh);this.quadraticCurveTo(x+w,y,x+w-ew,y);this.lineTo(x+ew,y);this.quadraticCurveTo(x,y,x,y+eh);this._draw();},drawWedge:function(x,y,startAngle,arc,radius,yRadius)
230 {this._drawingComplete=false;this._width=radius;this._height=radius;yRadius=yRadius||radius;this._path+=this._getWedgePath({x:x,y:y,startAngle:startAngle,arc:arc,radius:radius,yRadius:yRadius});this._width=radius*2;this._height=this._width;this._shape="shape";this._draw();},_getWedgePath:function(config)
231 {var x=config.x,y=config.y,startAngle=config.startAngle,arc=config.arc,radius=config.radius,yRadius=config.yRadius||radius,path;if(Math.abs(arc)>360)
232 {arc=360;}
233 startAngle*=-65535;arc*=65536;path=" m "+x+" "+y+" ae "+x+" "+y+" "+radius+" "+yRadius+" "+startAngle+" "+arc;return path;},end:function(){if(this._shape)
234 {this._draw();}
235 this._initProps();},lineGradientStyle:function(){},lineStyle:function(thickness,color,alpha,pixelHinting,scaleMode,caps,joints,miterLimit){this._stroke=1;this._strokeWeight=thickness*0.7;this._strokeColor=color;this._strokeOpacity=Y.Lang.isNumber(alpha)?alpha:1;},lineTo:function(point1,point2,etc){var args=arguments,i,len;if(typeof point1==='string'||typeof point1==='number'){args=[[point1,point2]];}
236 len=args.length;this._shape="shape";this._path+=' l ';for(i=0;i<len;++i){this._path+=' '+Math.round(args[i][0])+', '+Math.round(args[i][1]);this._trackSize.apply(this,args[i]);}},moveTo:function(x,y){this._path+=' m '+Math.round(x)+', '+Math.round(y);},setSize:function(w,h){w=Math.round(w);h=Math.round(h);this.node.style.width=w+'px';this.node.style.height=h+'px';this.node.coordSize=w+' '+h;this._canvasWidth=w;this._canvasHeight=h;},setPosition:function(x,y)
237 {x=Math.round(x);y=Math.round(y);this.node.style.left=x+"px";this.node.style.top=y+"px";},render:function(parentNode){var w=Math.max(parentNode.offsetWidth||0,this._canvasWidth),h=Math.max(parentNode.offsetHeight||0,this._canvasHeight);parentNode=parentNode||Y.config.doc.body;parentNode.appendChild(this.node);this.setSize(w,h);this._initProps();return this;},_shape:null,_trackSize:function(w,h){if(w>this._width){this._width=w;}
238 if(h>this._height){this._height=h;}},_initProps:function(){this._fillColor=null;this._strokeColor=null;this._strokeOpacity=null;this._strokeWeight=0;this._fillProps=null;this._path='';this._width=0;this._height=0;this._x=0;this._y=0;this._fill=null;this._stroke=0;this._stroked=false;},_clearPath:function()
239 {this._shape=null;this._path='';this._width=0;this._height=0;this._x=0;this._y=0;},_draw:function()
240 {var shape=this._createGraphicNode(this._shape),w=Math.round(this._width),h=Math.round(this._height),strokeNode,fillProps=this._fillProps;this.setSize(w,h);if(this._path)
241 {if(this._fill||this._fillProps)
242 {this._path+=' x';}
243 if(this._stroke)
244 {this._path+=' e';}
245 shape.path=this._path;shape.coordSize=w+', '+h;}
246 else
247 {shape.style.display="block";shape.style.position="absolute";shape.style.left=this._x+"px";shape.style.top=this._y+"px";}
248 if(this._fill){shape.fillColor=this._fillColor;}
249 else
250 {shape.filled=false;}
251 if(this._stroke&&this._strokeWeight>0){shape.strokeColor=this._strokeColor;shape.strokeWeight=this._strokeWeight;if(Y.Lang.isNumber(this._strokeOpacity)&&this._strokeOpacity<1)
252 {strokeNode=this._createGraphicNode("stroke");shape.appendChild(strokeNode);strokeNode.opacity=this._strokeOpacity;}}else{shape.stroked=false;}
253 shape.style.width=w+'px';shape.style.height=h+'px';if(fillProps){shape.filled=true;shape.appendChild(this._getFill());}
254 this.node.appendChild(shape);this._clearPath();},_getFill:function(){var fill=this._createGraphicNode("fill"),w=this._width,h=this._height,fillProps=this._fillProps,prop,pct,i=0,colors,colorstring="",len,ratios,hyp=Math.sqrt(Math.pow(w,2)+Math.pow(h,2)),cx=50,cy=50;if(this._gradientBox)
255 {cx=Math.round((this._gradientBox.width/2-((this._x-this._gradientBox.tx)*hyp/w))/(w*w/hyp)*100);cy=Math.round((this._gradientBox.height/2-((this._y-this._gradientBox.ty)*hyp/h))/(h*h/hyp)*100);fillProps.focussize=(this._gradientBox.width/w)/10+" "+(this._gradientBox.height/h)/10;}
256 if(fillProps.colors)
257 {colors=fillProps.colors.concat();ratios=fillProps.ratios.concat();len=colors.length;for(;i<len;++i){pct=ratios[i]||i/(len-1);pct=Math.round(100*pct)+"%";colorstring+=", "+pct+" "+colors[i];}
258 if(parseInt(pct,10)<100)
259 {colorstring+=", 100% "+colors[len-1];}}
260 for(prop in fillProps){if(fillProps.hasOwnProperty(prop)){fill.setAttribute(prop,fillProps[prop]);}}
261 fill.colors=colorstring.substr(2);if(fillProps.type==="gradientradial")
262 {fill.focusposition=cx+"%,"+cy+"%";}
263 return fill;},_createGraphics:function(){var group=this._createGraphicNode("group");group.style.display="inline-block";group.style.position='absolute';return group;},_createGraphicNode:function(type)
264 {return document.createElement('<'+type+' xmlns="urn:schemas-microsft.com:vml" class="vml'+type+'"/>');},_getNodeShapeType:function(type)
265 {var shape="shape";if(this._typeConversionHash.hasOwnProperty(type))
266 {shape=this._typeConversionHash[type];}
267 return shape;},_typeConversionHash:{circle:"oval",ellipse:"oval",rect:"rect"},getShape:function(config){config.graphic=this;return new Y.Shape(config);},addChild:function(child)
268 {this.node.appendChild(child);}};if(DRAWINGAPI=="vml")
269 {var sheet=document.createStyleSheet();sheet.addRule(".vmlgroup","behavior:url(#default#VML)",sheet.rules.length);sheet.addRule(".vmlgroup","display:inline-block",sheet.rules.length);sheet.addRule(".vmlgroup","zoom:1",sheet.rules.length);sheet.addRule(".vmlshape","behavior:url(#default#VML)",sheet.rules.length);sheet.addRule(".vmlshape","display:inline-block",sheet.rules.length);sheet.addRule(".vmloval","behavior:url(#default#VML)",sheet.rules.length);sheet.addRule(".vmloval","display:inline-block",sheet.rules.length);sheet.addRule(".vmlrect","behavior:url(#default#VML)",sheet.rules.length);sheet.addRule(".vmlrect","display:block",sheet.rules.length);sheet.addRule(".vmlfill","behavior:url(#default#VML)",sheet.rules.length);sheet.addRule(".vmlstroke","behavior:url(#default#VML)",sheet.rules.length);Y.Graphic=VMLGraphics;}
270 function Shape(cfg)
271 {this._initialize(cfg);this._draw();}
272 Y.extend(Shape,Y.Graphic,{type:"shape",autoSize:false,pointerEvents:"visiblePainted",_initialize:function(cfg)
273 {if(!cfg.graphic)
274 {cfg.graphic=new Y.Graphic();}
275 this._setProps(cfg);},_setProps:function(cfg)
276 {this.autoSize=cfg.autoSize||this.autoSize;this.pointerEvents=cfg.pointerEvents||this.pointerEvents;this.width=cfg.width||this.width;this.height=cfg.height||this.height;this.border=cfg.border||this.border;this.graphics=cfg.graphic||this.graphics;this.canvas=this.graphics;this.parentNode=this.graphics.node;this.fill=cfg.fill||this.fill;this.type=cfg.shape||this.type;this.nodetype=this._getNodeShapeType(this.type);this.props=cfg.props||this.props;this.path=cfg.path||this.path;},_draw:function()
277 {var cx,cy,rx,ry,parentNode=this.parentNode,borderWeight=0,fillWidth=this.width||0,fillHeight=this.height||0;if(!this.node)
278 {this.node=this._createGraphicNode(this.nodetype,this.pointerEvents);parentNode.appendChild(this.node);}
279 if(this.type=="wedge")
280 {this.path=this._getWedgePath(this.props);}
281 if(this.nodetype=="path")
282 {this._setPath();}
283 if(this.border&&this.border.weight&&this.border.weight>0)
284 {borderWeight=this.border.weight;fillWidth-=borderWeight*2;fillHeight-=borderWeight*2;}
285 this._addBorder();if(this.nodetype==="ellipse")
286 {rx=this.width/2;cx=this.width/2;ry=this.height/2;cy=this.height/2;rx-=borderWeight;ry-=borderWeight;this.node.setAttribute("cx",cx);this.node.setAttribute("cy",cy);this.node.setAttribute("rx",rx);this.node.setAttribute("ry",ry);}
287 else
288 {this.node.setAttribute("width",fillWidth);this.node.setAttribute("height",fillHeight);this.node.style.width=fillWidth+"px";this.node.style.height=fillHeight+"px";}
289 this._addFill();parentNode.style.width=this.width+"px";parentNode.style.height=this.height+"px";parentNode.setAttribute("width",this.width);parentNode.setAttribute("height",this.height);this.node.style.visibility="visible";this.node.setAttribute("x",borderWeight);this.node.setAttribute("y",borderWeight);return this;},_setPath:function()
290 {if(this.path)
291 {this.path+=" Z";this.node.setAttribute("d",this.path);}},_addBorder:function()
292 {if(this.border&&this.border.weight&&this.border.weight>0)
293 {var borderAlpha=this.border.alpha;this.border.color=this.border.color||"#000000";this.border.weight=this.border.weight||1;this.border.alpha=Y.Lang.isNumber(borderAlpha)?borderAlpha:1;this.border.linecap=this.border.linecap||"square";this.node.setAttribute("stroke",this.border.color);this.node.setAttribute("stroke-linecap",this.border.linecap);this.node.setAttribute("stroke-width",this.border.weight);this.node.setAttribute("stroke-opacity",this.border.alpha);}
294 else
295 {this.node.setAttribute("stroke","none");}},_addFill:function()
296 {var fillAlpha;if(this.fill.type==="linear"||this.fill.type==="radial")
297 {this.beginGradientFill(this.fill);this.node.appendChild(this._getFill());}
298 else if(this.fill.type==="bitmap")
299 {this.beginBitmapFill(this.fill);this.node.appendChild(this._getFill());}
300 else
301 {if(!this.fill.color)
302 {this.node.setAttribute("fill","none");}
303 else
304 {fillAlpha=this.fill.alpha;this.fill.alpha=Y.Lang.isNumber(fillAlpha)?fillAlpha:1;this.node.setAttribute("fill",this.fill.color);this.node.setAttribute("fill-opacity",fillAlpha);}}},end:function()
305 {this._setPath();},update:function(cfg)
306 {this._setProps(cfg);this._draw();return this;},_getNodeShapeType:function(type)
307 {if(this._typeConversionHash.hasOwnProperty(type))
308 {type=this._typeConversionHash[type];}
309 return type;},toggleVisible:function(val)
310 {var visibility=val?"visible":"hidden";if(this.node)
311 {this.node.style.visibility=visibility;}},addClass:function(className)
312 {var node=this.node;if(node)
313 {if(node.className&&node.className.baseVal)
314 {node.className.baseVal=Y.Lang.trim([node.className.baseVal,className].join(' '));}
315 else
316 {node.setAttribute("class",className);}}},setPosition:function(x,y)
317 {var pNode=Y.one(this.parentNode),hotspot=this.hotspot;pNode.setStyle("position","absolute");pNode.setStyle("left",x);pNode.setStyle("top",y);if(hotspot)
318 {hotspot.setStyle("position","absolute");hotspot.setStyle("left",x);hotspot.setStyle("top",y);}},_typeConversionHash:{circle:"ellipse",wedge:"path"}});Y.Shape=Shape;function CanvasShape(cfg)
319 {this._dummy=this._createDummy();this._canvas=this._createGraphic();this.node=this._canvas;this._context=this._canvas.getContext('2d');this._initialize(cfg);this._validate();}
320 Y.extend(CanvasShape,Y.CanvasDrawingUtil,{type:"shape",autoSize:false,_initialize:function(cfg)
321 {this._canvas.style.position="absolute";if(cfg.graphic)
322 {cfg.graphic.node.appendChild(this._canvas);}
323 this._setProps(cfg);},_setProps:function(cfg)
324 {this.autoSize=cfg.autoSize||this.autoSize;this.width=cfg.width||this.width;this.height=cfg.height||this.height;this.border=cfg.border||this.border;this.graphics=cfg.graphic||this.graphics;this.fill=cfg.fill||this.fill;this.type=cfg.shape||this.type;this.props=cfg.props||this.props;this.path=cfg.path||this.path;this.props=cfg.props||this.props;this.parentNode=this.graphics.node;},_validate:function()
325 {var w=this.width,h=this.height,border=this.border,type=this.type,fill=this.fill;this.clear();this.setSize(this.width,this.height);this._canvas.style.top="0px";this._canvas.style.left="0px";if(border&&border.weight&&border.weight>0)
326 {border.color=border.color||"#000";border.alpha=border.alpha||1;this.lineStyle(border.weight,border.color,border.alpha);}
327 if(fill.type==="radial"||fill.type==="linear")
328 {this.beginGradientFill(fill);}
329 else if(fill.type==="bitmap")
330 {this.beginBitmapFill(fill);}
331 else
332 {this.beginFill(fill.color,fill.alpha);}
333 switch(type)
334 {case"circle":this.drawEllipse(0,0,w,h);break;case"rect":this.drawRect(0,0,w,h);break;case"wedge":this.drawWedge(this.props);break;}
335 return this;},update:function(cfg)
336 {this._setProps(cfg);this._validate();return this;},toggleVisible:function(val)
337 {var visibility=val?"visible":"hidden";if(this.node)
338 {this.node.style.visibility=visibility;}},setPosition:function(x,y)
339 {var pNode=Y.one(this.parentNode);pNode.setStyle("position","absolute");pNode.setStyle("left",x);pNode.setStyle("top",y);},addClass:function(val)
340 {if(this.node)
341 {this.node.style.pointerEvents="painted";this.node.setAttribute("class",val);}}});Y.CanvasShape=CanvasShape;if(DRAWINGAPI=="canvas")
342 {Y.Shape=Y.CanvasShape;}
343 function VMLShape(cfg)
344 {this._initialize(cfg);this._draw();}
345 VMLShape.prototype={type:"shape",_initialize:function(cfg)
346 {if(!cfg.graphic)
347 {cfg.graphic=new Y.Graphic();}
348 this._setProps(cfg);},width:0,height:0,_setProps:function(cfg){this.width=cfg.width&&cfg.width>=0?cfg.width:this.width;this.height=cfg.height&&cfg.height>=0?cfg.height:this.height;this.border=cfg.border||this.border;this.graphics=cfg.graphic||this.graphics;this.canvas=this.graphics;this.parentNode=this.graphics.node;this.fill=cfg.fill||this.fill;this.type=cfg.shape||this.type;this.props=cfg.props||this.props;},_draw:function()
349 {var path,borderWeight=0,fillWidth=this.width||0,fillHeight=this.height||0;this.graphics.setSize(fillWidth,fillHeight);if(this.node)
350 {this.node.style.visible="hidden";}
351 else if(!this.node)
352 {this.node=this.graphics._createGraphicNode(this.graphics._getNodeShapeType(this.type));this.graphics.node.appendChild(this.node);}
353 if(this.type==="wedge")
354 {path=this.graphics._getWedgePath(this.props);if(this.fill)
355 {path+=' x';}
356 if(this.border)
357 {path+=' e';}
358 this.node.path=path;}
359 this._addBorder();if(this.border&&this.border.weight&&this.border.weight>0)
360 {borderWeight=this.border.weight;fillWidth-=borderWeight;fillHeight-=borderWeight;}
361 this.node.style.width=Math.max(fillWidth,0)+"px";this.node.style.height=Math.max(fillHeight,0)+"px";this._addFill();return this;},_addBorder:function()
362 {if(this.border&&this.border.weight&&this.border.weight>0)
363 {var borderAlpha=this.border.alpha,borderWeight=this.borderWeight;borderAlpha=Y.Lang.isNumber(borderAlpha)?borderAlpha:1;borderWeight=Y.Lang.isNumber(borderWeight)?borderWeight:1;this.node.strokecolor=this.border.color||"#000000";this.node.strokeweight=borderWeight;if(borderAlpha<1)
364 {if(!this._strokeNode)
365 {this._strokeNode=this.graphics._createGraphicNode("stroke");this.node.appendChild(this._strokeNode);}
366 this._strokeNode.opacity=borderAlpha;}
367 else if(this._strokeNode)
368 {this._strokeNode.opacity=borderAlpha;}
369 this.node.stroked=true;}
370 else
371 {this.node.stroked=false;}},_addFill:function()
372 {var fillAlpha;this.node.filled=true;if(this.fill.type==="linear"||this.fill.type==="radial")
373 {this.graphics.beginGradientFill(this.fill);this.node.appendChild(this.graphics._getFill());}
374 else if(this.fill.type==="bitmap")
375 {this.graphics.beginBitmapFill(this.fill);this.node.appendChild(this.graphics._getFill());}
376 else
377 {if(!this.fill.color)
378 {this.node.filled=false;}
379 else
380 {if(this.fillnode)
381 {this.graphics._removeChildren(this.fillnode);}
382 fillAlpha=this.fill.alpha;fillAlpha=Y.Lang.isNumber(fillAlpha)?fillAlpha:1;this.fill.alpha=fillAlpha;this.fillnode=this.graphics._createGraphicNode("fill");this.fillnode.type="solid";this.fillnode.color=this.fill.color;this.fillnode.opacity=fillAlpha;this.node.appendChild(this.fillnode);}}},addClass:function(val)
383 {var node=this.node;if(node)
384 {Y.one(node).addClass(val);}},toggleVisible:function(val)
385 {var visibility=val?"visible":"hidden";if(this.node)
386 {Y.one(this.node).setStyle("visibility",visibility);}},setPosition:function(x,y)
387 {var pNode=Y.one(this.parentNode);pNode.setStyle("position","absolute");pNode.setStyle("left",x);pNode.setStyle("top",y);},update:function(cfg)
388 {this._setProps(cfg);this._draw();return this;}};Y.VMLShape=VMLShape;if(DRAWINGAPI=="vml"){Y.Shape=VMLShape;}
389 function Renderer(){}
390 Renderer.ATTRS={styles:{getter:function()
391 {this._styles=this._styles||this._getDefaultStyles();return this._styles;},setter:function(val)
392 {this._styles=this._setStyles(val);}},graphic:{}};Renderer.NAME="renderer";Renderer.prototype={_styles:null,_setStyles:function(newstyles)
393 {var styles=this.get("styles");return this._mergeStyles(newstyles,styles);},_mergeStyles:function(a,b)
394 {if(!b)
395 {b={};}
396 var newstyles=Y.merge(b,{});Y.Object.each(a,function(value,key,a)
397 {if(b.hasOwnProperty(key)&&Y.Lang.isObject(value)&&!Y.Lang.isArray(value))
398 {newstyles[key]=this._mergeStyles(value,b[key]);}
399 else
400 {newstyles[key]=value;}},this);return newstyles;},_getDefaultStyles:function()
401 {return{padding:{top:0,right:0,bottom:0,left:0}};}};Y.augment(Renderer,Y.Attribute);Y.Renderer=Renderer;Y.Axis=Y.Base.create("axis",Y.Widget,[Y.Renderer],{_dataChangeHandler:function(e)
402 {if(this.get("rendered"))
403 {this._drawAxis();}},_updateHandler:function(e)
404 {if(this.get("rendered"))
405 {this._drawAxis();}},_positionChangeHandler:function(e)
406 {var position=this.get("position");if(position=="none")
407 {return;}
408 this._layout=this.getLayout(this.get("position"));if(this.get("rendered"))
409 {this._drawAxis();}},renderUI:function()
410 {var pos=this.get("position");if(pos&&pos!="none")
411 {this._layout=this.getLayout(pos);this._setCanvas();}},syncUI:function()
412 {this._drawAxis();},_setCanvas:function()
413 {var cb=this.get("contentBox"),bb=this.get("boundingBox"),p=this.get("position"),pn=this._parentNode,w=this.get("width"),h=this.get("height");bb.setStyle("position","absolute");w=w?w+"px":pn.getStyle("width");h=h?h+"px":pn.getStyle("height");if(p==="top"||p==="bottom")
414 {cb.setStyle("width",w);}
415 else
416 {cb.setStyle("height",h);}
417 cb.setStyle("position","relative");cb.setStyle("left","0px");cb.setStyle("top","0px");this.set("graphic",new Y.Graphic());this.get("graphic").render(cb);},_getDefaultStyles:function()
418 {var axisstyles={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:4,right:4,bottom:4,left:4}},hideOverlappingLabelTicks:false};return Y.merge(Y.Renderer.prototype._getDefaultStyles(),axisstyles);},_handleSizeChange:function(e)
419 {var attrName=e.attrName,pos=this.get("position"),vert=pos=="left"||pos=="right",cb=this.get("contentBox"),hor=pos=="bottom"||pos=="top";cb.setStyle("width",this.get("width"));cb.setStyle("height",this.get("height"));if((hor&&attrName=="width")||(vert&&attrName=="height"))
420 {this._drawAxis();}},_layout:null,getLayout:function(pos)
421 {var l;switch(pos)
422 {case"top":l=new Y.TopAxisLayout({axisRenderer:this});break;case"bottom":l=new Y.BottomAxisLayout({axisRenderer:this});break;case"left":l=new Y.LeftAxisLayout({axisRenderer:this});break;case"right":l=new Y.RightAxisLayout({axisRenderer:this});break;}
423 return l;},drawLine:function(startPoint,endPoint,line)
424 {var graphic=this.get("graphic");graphic.lineStyle(line.weight,line.color,line.alpha);graphic.moveTo(startPoint.x,startPoint.y);graphic.lineTo(endPoint.x,endPoint.y);graphic.end();},_drawAxis:function()
425 {if(this._drawing)
426 {this._callLater=true;return;}
427 this._drawing=true;this._callLater=false;if(this.get("position")!="none")
428 {var styles=this.get("styles"),majorTickStyles=styles.majorTicks,drawTicks=majorTickStyles.display!="none",tickPoint,majorUnit=styles.majorUnit,len,majorUnitDistance,i=0,layoutLength,position,lineStart,label,layout=this._layout,labelFunction=this.get("labelFunction"),labelFunctionScope=this.get("labelFunctionScope"),labelFormat=this.get("labelFormat"),graphic=this.get("graphic");graphic.clear();layout.setTickOffsets();layoutLength=this.getLength();lineStart=layout.getLineStart();len=this.getTotalMajorUnits(majorUnit);majorUnitDistance=this.getMajorUnitDistance(len,layoutLength,majorUnit);this.set("edgeOffset",this.getEdgeOffset(len,layoutLength)*0.5);tickPoint=this.getFirstPoint(lineStart);this.drawLine(lineStart,this.getLineEnd(tickPoint),styles.line);if(drawTicks)
429 {layout.drawTick(tickPoint,majorTickStyles);}
430 if(len<1)
431 {this._clearLabelCache();return;}
432 this._createLabelCache();this._tickPoints=[];layout.set("maxLabelSize",0);for(;i<len;++i)
433 {if(drawTicks)
434 {layout.drawTick(tickPoint,majorTickStyles);}
435 position=this.getPosition(tickPoint);label=this.getLabel(tickPoint);label.innerHTML=labelFunction.apply(labelFunctionScope,[this.getLabelByIndex(i,len),labelFormat]);tickPoint=this.getNextPoint(tickPoint,majorUnitDistance);}
436 this._clearLabelCache();layout.setSizeAndPosition();if(this.get("overlapGraph"))
437 {layout.offsetNodeForTick(this.get("contentBox"));}
438 layout.setCalculatedSize();for(i=0;i<len;++i)
439 {layout.positionLabel(this.get("labels")[i],this._tickPoints[i]);}}
440 this._drawing=false;if(this._callLater)
441 {this._drawAxis();}
442 else
443 {this.fire("axisRendered");}},_labels:null,_labelCache:null,getLabel:function(pt,pos)
444 {var i,label,customStyles={rotation:"rotation",margin:"margin",alpha:"alpha"},cache=this._labelCache,styles=this.get("styles").label;if(cache.length>0)
445 {label=cache.shift();}
446 else
447 {label=document.createElement("span");label.style.display="block";label.style.whiteSpace="nowrap";Y.one(label).addClass("axisLabel");this.get("contentBox").appendChild(label);}
448 label.style.position="absolute";this._labels.push(label);this._tickPoints.push({x:pt.x,y:pt.y});this._layout.updateMaxLabelSize(label);for(i in styles)
449 {if(styles.hasOwnProperty(i)&&!customStyles.hasOwnProperty(i))
450 {label.style[i]=styles[i];}}
451 return label;},_createLabelCache:function()
452 {if(this._labels)
453 {if(this._labelCache)
454 {this._labelCache=this._labels.concat(this._labelCache);}
455 else
456 {this._labelCache=this._labels.concat();}}
457 else
458 {this._clearLabelCache();}
459 this._labels=[];},_clearLabelCache:function()
460 {if(this._labelCache)
461 {var len=this._labelCache.length,i=0,label,labelCache=this._labelCache;for(;i<len;++i)
462 {label=labelCache[i];label.parentNode.removeChild(label);}}
463 this._labelCache=[];},_calculateSizeByTickLength:true,getLineEnd:function(pt)
464 {var w=this.get("width"),h=this.get("height"),pos=this.get("position");if(pos==="top"||pos==="bottom")
465 {return{x:w,y:pt.y};}
466 else
467 {return{x:pt.x,y:h};}},getLength:function()
468 {var l,style=this.get("styles"),padding=style.padding,w=this.get("width"),h=this.get("height"),pos=this.get("position");if(pos==="top"||pos==="bottom")
469 {l=w-(padding.left+padding.right);}
470 else
471 {l=h-(padding.top+padding.bottom);}
472 return l;},getFirstPoint:function(pt)
473 {var style=this.get("styles"),pos=this.get("position"),padding=style.padding,np={x:pt.x,y:pt.y};if(pos==="top"||pos==="bottom")
474 {np.x+=padding.left+this.get("edgeOffset");}
475 else
476 {np.y+=this.get("height")-(padding.top+this.get("edgeOffset"));}
477 return np;},getNextPoint:function(point,majorUnitDistance)
478 {var pos=this.get("position");if(pos==="top"||pos==="bottom")
479 {point.x=point.x+majorUnitDistance;}
480 else
481 {point.y=point.y-majorUnitDistance;}
482 return point;},getLastPoint:function()
483 {var style=this.get("styles"),padding=style.padding,w=this.get("width"),pos=this.get("position");if(pos==="top"||pos==="bottom")
484 {return{x:w-padding.right,y:padding.top};}
485 else
486 {return{x:padding.left,y:padding.top};}},getPosition:function(point)
487 {var p,h=this.get("height"),style=this.get("styles"),padding=style.padding,pos=this.get("position"),dataType=this.get("dataType");if(pos==="left"||pos==="right")
488 {if(dataType==="numeric")
489 {p=(h-(padding.top+padding.bottom))-(point.y-padding.top);}
490 else
491 {p=point.y-padding.top;}}
492 else
493 {p=point.x-padding.left;}
494 return p;}},{ATTRS:{edgeOffset:{value:0},graphic:{},node:{},position:{lazyAdd:false,setOnce:true,setter:function(val)
495 {if(val=="none")
496 {this.bindUI();}
497 return val;}},topTickOffset:{value:0},bottomTickOffset:{value:0},leftTickOffset:{value:0},rightTickOffset:{value:0},labels:{readOnly:true,getter:function()
498 {return this._labels;}},tickPoints:{readOnly:true,getter:function()
499 {if(this.get("position")=="none")
500 {return this.get("styles").majorUnit.count;}
501 return this._tickPoints;}},overlapGraph:{value:true,validator:function(val)
502 {return Y.Lang.isBoolean(val);}},labelFunctionScope:{}}});function LeftAxisLayout(config)
503 {LeftAxisLayout.superclass.constructor.apply(this,arguments);}
504 LeftAxisLayout.ATTRS={axisRenderer:{value:null},maxLabelSize:{value:0}};Y.extend(LeftAxisLayout,Y.Base,{setTickOffsets:function()
505 {var ar=this.get("axisRenderer"),majorTicks=ar.get("styles").majorTicks,tickLength=majorTicks.length,halfTick=tickLength*0.5,display=majorTicks.display;ar.set("topTickOffset",0);ar.set("bottomTickOffset",0);switch(display)
506 {case"inside":ar.set("rightTickOffset",tickLength);ar.set("leftTickOffset",0);break;case"outside":ar.set("rightTickOffset",0);ar.set("leftTickOffset",tickLength);break;case"cross":ar.set("rightTickOffset",halfTick);ar.set("leftTickOffset",halfTick);break;default:ar.set("rightTickOffset",0);ar.set("leftTickOffset",0);break;}},drawTick:function(pt,tickStyles)
507 {var ar=this.get("axisRenderer"),style=ar.get("styles"),padding=style.padding,tickLength=tickStyles.length,start={x:padding.left,y:pt.y},end={x:tickLength+padding.left,y:pt.y};ar.drawLine(start,end,tickStyles);},getLineStart:function()
508 {var ar=this.get("axisRenderer"),style=ar.get("styles"),padding=style.padding,majorTicks=style.majorTicks,tickLength=majorTicks.length,display=majorTicks.display,pt={x:padding.left,y:0};if(display==="outside")
509 {pt.x+=tickLength;}
510 else if(display==="cross")
511 {pt.x+=tickLength/2;}
512 return pt;},getLabelPoint:function(point)
513 {var ar=this.get("axisRenderer");return{x:point.x-ar.get("leftTickOffset"),y:point.y};},updateMaxLabelSize:function(label)
514 {var ar=this.get("axisRenderer"),style=ar.get("styles").label,rot=Math.min(90,Math.max(-90,style.rotation)),absRot=Math.abs(rot),radCon=Math.PI/180,sinRadians=parseFloat(parseFloat(Math.sin(absRot*radCon)).toFixed(8)),cosRadians=parseFloat(parseFloat(Math.cos(absRot*radCon)).toFixed(8)),m11=cosRadians,m12=rot>0?-sinRadians:sinRadians,m21=-m12,m22=m11,max;if(!document.createElementNS)
515 {label.style.filter='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),label.offsetWidth));}
516 else
517 {label.style.msTransform="rotate(0deg)";if(rot===0)
518 {max=label.offsetWidth;}
519 else if(absRot===90)
520 {max=label.offsetHeight;}
521 else
522 {max=(cosRadians*label.offsetWidth)+(sinRadians*label.offsetHeight);}
523 this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),max));}},positionLabel:function(label,pt)
524 {var ar=this.get("axisRenderer"),tickOffset=ar.get("leftTickOffset"),style=ar.get("styles").label,labelAlpha=style.alpha,filterString,margin=0,leftOffset=pt.x,topOffset=pt.y,rot=Math.min(90,Math.max(-90,style.rotation)),absRot=Math.abs(rot),radCon=Math.PI/180,sinRadians=parseFloat(parseFloat(Math.sin(absRot*radCon)).toFixed(8)),cosRadians=parseFloat(parseFloat(Math.cos(absRot*radCon)).toFixed(8)),m11=cosRadians,m12=rot>0?-sinRadians:sinRadians,m21=-m12,m22=m11,maxLabelSize=this.get("maxLabelSize"),labelWidth=Math.round(label.offsetWidth),labelHeight=Math.round(label.offsetHeight);if(style.margin&&style.margin.right)
525 {margin=style.margin.right;}
526 if(!document.createElementNS)
527 {label.style.filter=null;labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);if(rot===0)
528 {leftOffset=labelWidth;topOffset-=labelHeight*0.5;}
529 else if(absRot===90)
530 {leftOffset=labelHeight;topOffset-=labelWidth*0.5;}
531 else if(rot>0)
532 {leftOffset=(cosRadians*labelWidth)+(labelHeight*rot/90);topOffset-=(sinRadians*labelWidth)+(cosRadians*(labelHeight*0.5));}
533 else
534 {leftOffset=(cosRadians*labelWidth)+(absRot/90*labelHeight);topOffset-=cosRadians*(labelHeight*0.5);}
535 leftOffset+=tickOffset;label.style.left=((pt.x+maxLabelSize)-leftOffset)+"px";label.style.top=topOffset+"px";if(filterString)
536 {filterString+=" ";}
537 if(Y.Lang.isNumber(labelAlpha)&&labelAlpha<1&&labelAlpha>-1&&!isNaN(labelAlpha))
538 {filterString="progid:DXImageTransform.Microsoft.Alpha(Opacity="+Math.round(labelAlpha*100)+")";}
539 if(rot!==0)
540 {if(filterString)
541 {filterString+=" ";}
542 else
543 {filterString="";}
544 filterString+='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';}
545 if(filterString)
546 {label.style.filter=filterString;}
547 return;}
548 label.style.msTransform="rotate(0deg)";labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);if(rot===0)
549 {leftOffset-=labelWidth;topOffset-=labelHeight*0.5;}
550 else if(rot===90)
551 {topOffset-=labelWidth*0.5;}
552 else if(rot===-90)
553 {leftOffset-=labelHeight;topOffset+=labelWidth*0.5;}
554 else
555 {if(rot<0)
556 {leftOffset-=(cosRadians*labelWidth)+(sinRadians*labelHeight);topOffset+=(sinRadians*labelWidth)-(cosRadians*(labelHeight*0.6));}
557 else
558 {leftOffset-=(cosRadians*labelWidth);topOffset-=(sinRadians*labelWidth)+(cosRadians*(labelHeight*0.6));}}
559 leftOffset-=tickOffset;label.style.left=(this.get("maxLabelSize")+leftOffset)+"px";label.style.top=topOffset+"px";label.style.MozTransformOrigin="0 0";label.style.MozTransform="rotate("+rot+"deg)";label.style.webkitTransformOrigin="0 0";label.style.webkitTransform="rotate("+rot+"deg)";label.style.msTransformOrigin="0 0";label.style.msTransform="rotate("+rot+"deg)";label.style.OTransformOrigin="0 0";label.style.OTransform="rotate("+rot+"deg)";},setSizeAndPosition:function()
560 {var labelSize=this.get("maxLabelSize"),ar=this.get("axisRenderer"),style=ar.get("styles"),leftTickOffset=ar.get("leftTickOffset"),sz=labelSize+leftTickOffset,graphic=ar.get("graphic"),margin=style.label.margin;if(margin&&margin.right)
561 {sz+=margin.right;}
562 sz=Math.round(sz);ar.set("width",sz);ar.get("contentBox").setStyle("width",sz);Y.one(graphic.node).setStyle("left",labelSize+margin.right);},offsetNodeForTick:function(cb)
563 {},setCalculatedSize:function()
564 {var ar=this.get("axisRenderer"),style=ar.get("styles"),label=style.label,tickOffset=ar.get("leftTickOffset"),max=this.get("maxLabelSize"),ttl=Math.round(tickOffset+max+label.margin.right);ar.get("contentBox").setStyle("width",ttl);ar.set("width",ttl);}});Y.LeftAxisLayout=LeftAxisLayout;function RightAxisLayout(config)
565 {RightAxisLayout.superclass.constructor.apply(this,arguments);}
566 RightAxisLayout.ATTRS={axisRenderer:{value:null}};Y.extend(RightAxisLayout,Y.Base,{setTickOffsets:function()
567 {var ar=this.get("axisRenderer"),majorTicks=ar.get("styles").majorTicks,tickLength=majorTicks.length,halfTick=tickLength*0.5,display=majorTicks.display;ar.set("topTickOffset",0);ar.set("bottomTickOffset",0);switch(display)
568 {case"inside":ar.set("leftTickOffset",tickLength);ar.set("rightTickOffset",0);break;case"outside":ar.set("leftTickOffset",0);ar.set("rightTickOffset",tickLength);break;case"cross":ar.set("rightTickOffset",halfTick);ar.set("leftTickOffset",halfTick);break;default:ar.set("leftTickOffset",0);ar.set("rightTickOffset",0);break;}},drawTick:function(pt,tickStyles)
569 {var ar=this.get("axisRenderer"),style=ar.get("styles"),padding=style.padding,tickLength=tickStyles.length,start={x:padding.left,y:pt.y},end={x:padding.left+tickLength,y:pt.y};ar.drawLine(start,end,tickStyles);},getLineStart:function()
570 {var ar=this.get("axisRenderer"),style=ar.get("styles"),padding=style.padding,majorTicks=style.majorTicks,tickLength=majorTicks.length,display=majorTicks.display,pt={x:padding.left,y:padding.top};if(display==="inside")
571 {pt.x+=tickLength;}
572 else if(display==="cross")
573 {pt.x+=tickLength/2;}
574 return pt;},getLabelPoint:function(point)
575 {var ar=this.get("axisRenderer");return{x:point.x+ar.get("rightTickOffset"),y:point.y};},updateMaxLabelSize:function(label)
576 {var ar=this.get("axisRenderer"),style=ar.get("styles").label,rot=Math.min(90,Math.max(-90,style.rotation)),absRot=Math.abs(rot),radCon=Math.PI/180,sinRadians=parseFloat(parseFloat(Math.sin(absRot*radCon)).toFixed(8)),cosRadians=parseFloat(parseFloat(Math.cos(absRot*radCon)).toFixed(8)),m11=cosRadians,m12=rot>0?-sinRadians:sinRadians,m21=-m12,m22=m11,max;if(!document.createElementNS)
577 {label.style.filter='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),label.offsetWidth));}
578 else
579 {label.style.msTransform="rotate(0deg)";if(rot===0)
580 {max=label.offsetWidth;}
581 else if(absRot===90)
582 {max=label.offsetHeight;}
583 else
584 {max=(cosRadians*label.offsetWidth)+(sinRadians*label.offsetHeight);}
585 this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),max));}},positionLabel:function(label,pt)
586 {var ar=this.get("axisRenderer"),tickOffset=ar.get("rightTickOffset"),style=ar.get("styles").label,labelAlpha=style.alpha,filterString,margin=0,leftOffset=pt.x,topOffset=pt.y,rot=Math.min(Math.max(style.rotation,-90),90),absRot=Math.abs(rot),radCon=Math.PI/180,sinRadians=parseFloat(parseFloat(Math.sin(absRot*radCon)).toFixed(8)),cosRadians=parseFloat(parseFloat(Math.cos(absRot*radCon)).toFixed(8)),m11=cosRadians,m12=rot>0?-sinRadians:sinRadians,m21=-m12,m22=m11,labelWidth=Math.round(label.offsetWidth),labelHeight=Math.round(label.offsetHeight);if(style.margin&&style.margin.right)
587 {margin=style.margin.right;}
588 if(!document.createElementNS)
589 {label.style.filter=null;if(rot===0)
590 {topOffset-=labelHeight*0.5;}
591 else if(absRot===90)
592 {topOffset-=labelWidth*0.5;}
593 else if(rot>0)
594 {topOffset-=(cosRadians*(labelHeight*0.5));}
595 else
596 {topOffset-=(sinRadians*labelWidth)+(cosRadians*(labelHeight*0.5));}
597 leftOffset+=margin;leftOffset+=tickOffset;label.style.left=leftOffset+"px";label.style.top=topOffset+"px";if(Y.Lang.isNumber(labelAlpha)&&labelAlpha<1&&labelAlpha>-1&&!isNaN(labelAlpha))
598 {filterString="progid:DXImageTransform.Microsoft.Alpha(Opacity="+Math.round(labelAlpha*100)+")";}
599 if(rot!==0)
600 {if(filterString)
601 {filterString+=" ";}
602 else
603 {filterString="";}
604 filterString+='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';}
605 if(filterString)
606 {label.style.filter=filterString;}
607 return;}
608 label.style.msTransform="rotate(0deg)";labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);if(rot===0)
609 {topOffset-=labelHeight*0.5;}
610 else if(rot===90)
611 {leftOffset+=labelHeight;topOffset-=labelWidth*0.5;}
612 else if(rot===-90)
613 {topOffset+=labelWidth*0.5;}
614 else if(rot<0)
615 {topOffset-=(cosRadians*(labelHeight*0.6));}
616 else
617 {topOffset-=cosRadians*(labelHeight*0.6);leftOffset+=sinRadians*labelHeight;}
618 leftOffset+=margin;leftOffset+=tickOffset;label.style.left=leftOffset+"px";label.style.top=topOffset+"px";label.style.MozTransformOrigin="0 0";label.style.MozTransform="rotate("+rot+"deg)";label.style.webkitTransformOrigin="0 0";label.style.webkitTransform="rotate("+rot+"deg)";label.style.msTransformOrigin="0 0";label.style.msTransform="rotate("+rot+"deg)";label.style.OTransformOrigin="0 0";label.style.OTransform="rotate("+rot+"deg)";},setSizeAndPosition:function()
619 {var ar=this.get("axisRenderer"),label=ar.get("styles").label,labelSize=this.get("maxLabelSize"),tickOffset=ar.get("rightTickOffset"),sz=tickOffset+labelSize;if(label.margin&&label.margin.weight)
620 {sz+=label.margin.weight;}
621 ar.set("width",sz);ar.get("contentBox").setStyle("width",sz);},offsetNodeForTick:function(cb)
622 {var ar=this.get("axisRenderer"),tickOffset=ar.get("leftTickOffset"),offset=0-tickOffset;cb.setStyle("left",offset);},setCalculatedSize:function()
623 {var ar=this.get("axisRenderer"),style=ar.get("styles").label,ttl=Math.round(ar.get("rightTickOffset")+this.get("maxLabelSize")+style.margin.left);ar.set("width",ttl);}});Y.RightAxisLayout=RightAxisLayout;function BottomAxisLayout(config)
624 {BottomAxisLayout.superclass.constructor.apply(this,arguments);}
625 BottomAxisLayout.ATTRS={axisRenderer:{value:null},maxLabelSize:{value:0}};Y.extend(BottomAxisLayout,Y.Base,{setTickOffsets:function()
626 {var ar=this.get("axisRenderer"),majorTicks=ar.get("styles").majorTicks,tickLength=majorTicks.length,halfTick=tickLength*0.5,display=majorTicks.display;ar.set("leftTickOffset",0);ar.set("rightTickOffset",0);switch(display)
627 {case"inside":ar.set("topTickOffset",tickLength);ar.set("bottomTickOffset",0);break;case"outside":ar.set("topTickOffset",0);ar.set("bottomTickOffset",tickLength);break;case"cross":ar.set("topTickOffset",halfTick);ar.set("bottomTickOffset",halfTick);break;default:ar.set("topTickOffset",0);ar.set("bottomTickOffset",0);break;}},getLineStart:function()
628 {var ar=this.get("axisRenderer"),style=ar.get("styles"),padding=style.padding,majorTicks=style.majorTicks,tickLength=majorTicks.length,display=majorTicks.display,pt={x:0,y:padding.top};if(display==="inside")
629 {pt.y+=tickLength;}
630 else if(display==="cross")
631 {pt.y+=tickLength/2;}
632 return pt;},drawTick:function(pt,tickStyles)
633 {var ar=this.get("axisRenderer"),style=ar.get("styles"),padding=style.padding,tickLength=tickStyles.length,start={x:pt.x,y:padding.top},end={x:pt.x,y:tickLength+padding.top};ar.drawLine(start,end,tickStyles);},getLabelPoint:function(point)
634 {var ar=this.get("axisRenderer");return{x:point.x,y:point.y+ar.get("bottomTickOffset")};},updateMaxLabelSize:function(label)
635 {var ar=this.get("axisRenderer"),style=ar.get("styles").label,rot=Math.min(90,Math.max(-90,style.rotation)),absRot=Math.abs(rot),radCon=Math.PI/180,sinRadians=parseFloat(parseFloat(Math.sin(absRot*radCon)).toFixed(8)),cosRadians=parseFloat(parseFloat(Math.cos(absRot*radCon)).toFixed(8)),m11=cosRadians,m12=rot>0?-sinRadians:sinRadians,m21=-m12,m22=m11,max;if(!document.createElementNS)
636 {label.style.filter='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),label.offsetHeight));}
637 else
638 {label.style.msTransform="rotate(0deg)";if(rot===0)
639 {max=label.offsetHeight;}
640 else if(absRot===90)
641 {max=label.offsetWidth;}
642 else
643 {max=(sinRadians*label.offsetWidth)+(cosRadians*label.offsetHeight);}
644 this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),max));}},positionLabel:function(label,pt)
645 {var ar=this.get("axisRenderer"),tickOffset=ar.get("bottomTickOffset"),style=ar.get("styles").label,labelAlpha=style.alpha,filterString,margin=0,leftOffset=Math.round(pt.x),topOffset=Math.round(pt.y),rot=Math.min(90,Math.max(-90,style.rotation)),absRot=Math.abs(rot),radCon=Math.PI/180,sinRadians=parseFloat(parseFloat(Math.sin(absRot*radCon)).toFixed(8)),cosRadians=parseFloat(parseFloat(Math.cos(absRot*radCon)).toFixed(8)),m11=cosRadians,m12=rot>0?-sinRadians:sinRadians,m21=-m12,m22=m11,labelWidth=Math.round(label.offsetWidth),labelHeight=Math.round(label.offsetHeight);if(style.margin&&style.margin.top)
646 {margin=style.margin.top;}
647 if(!document.createElementNS)
648 {m11=cosRadians;m12=rot>0?-sinRadians:sinRadians;m21=-m12;m22=m11;label.style.filter=null;labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);if(absRot===90)
649 {leftOffset-=labelHeight*0.5;}
650 else if(rot<0)
651 {leftOffset-=cosRadians*labelWidth;leftOffset-=sinRadians*(labelHeight*0.5);}
652 else if(rot>0)
653 {leftOffset-=sinRadians*(labelHeight*0.5);}
654 else
655 {leftOffset-=labelWidth*0.5;}
656 topOffset+=margin;topOffset+=tickOffset;label.style.left=Math.round(leftOffset)+"px";label.style.top=Math.round(topOffset)+"px";if(Y.Lang.isNumber(labelAlpha)&&labelAlpha<1&&labelAlpha>-1&&!isNaN(labelAlpha))
657 {filterString="progid:DXImageTransform.Microsoft.Alpha(Opacity="+Math.round(labelAlpha*100)+")";}
658 if(rot!==0)
659 {if(filterString)
660 {filterString+=" ";}
661 else
662 {filterString="";}
663 filterString+='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';}
664 if(filterString)
665 {label.style.filter=filterString;}
666 return;}
667 label.style.msTransform="rotate(0deg)";labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);if(rot===0)
668 {leftOffset-=labelWidth*0.5;}
669 else if(absRot===90)
670 {if(rot===90)
671 {leftOffset+=labelHeight*0.5;}
672 else
673 {topOffset+=labelWidth;leftOffset-=labelHeight*0.5;}}
674 else
675 {if(rot<0)
676 {leftOffset-=(cosRadians*labelWidth)+(sinRadians*(labelHeight*0.6));topOffset+=sinRadians*labelWidth;}
677 else
678 {leftOffset+=Math.round(sinRadians*(labelHeight*0.6));}}
679 topOffset+=margin;topOffset+=tickOffset;label.style.left=Math.round(leftOffset)+"px";label.style.top=Math.round(topOffset)+"px";label.style.MozTransformOrigin="0 0";label.style.MozTransform="rotate("+rot+"deg)";label.style.webkitTransformOrigin="0 0";label.style.webkitTransform="rotate("+rot+"deg)";label.style.msTransformOrigin="0 0";label.style.msTransform="rotate("+rot+"deg)";label.style.OTransformOrigin="0 0";label.style.OTransform="rotate("+rot+"deg)";},setSizeAndPosition:function()
680 {var labelSize=this.get("maxLabelSize"),ar=this.get("axisRenderer"),tickLength=ar.get("bottomTickLength"),style=ar.get("styles"),sz=tickLength+labelSize,margin=style.label.margin;if(margin&&margin.top)
681 {sz+=margin.top;}
682 sz=Math.round(sz);ar.set("height",sz);},offsetNodeForTick:function(cb)
683 {var ar=this.get("axisRenderer");ar.get("contentBox").setStyle("top",0-ar.get("topTickOffset"));},setCalculatedSize:function()
684 {var ar=this.get("axisRenderer"),style=ar.get("styles").label,ttl=Math.round(ar.get("bottomTickOffset")+this.get("maxLabelSize")+style.margin.top);ar.set("height",ttl);}});Y.BottomAxisLayout=BottomAxisLayout;function TopAxisLayout(config)
685 {TopAxisLayout.superclass.constructor.apply(this,arguments);}
686 TopAxisLayout.ATTRS={axisRenderer:{value:null},maxLabelSize:{value:0}};Y.extend(TopAxisLayout,Y.Base,{setTickOffsets:function()
687 {var ar=this.get("axisRenderer"),majorTicks=ar.get("styles").majorTicks,tickLength=majorTicks.length,halfTick=tickLength*0.5,display=majorTicks.display;ar.set("leftTickOffset",0);ar.set("rightTickOffset",0);switch(display)
688 {case"inside":ar.set("bottomTickOffset",tickLength);ar.set("topTickOffset",0);break;case"outside":ar.set("bottomTickOffset",0);ar.set("topTickOffset",tickLength);break;case"cross":ar.set("topTickOffset",halfTick);ar.set("bottomTickOffset",halfTick);break;default:ar.set("topTickOffset",0);ar.set("bottomTickOffset",0);break;}},getLineStart:function()
689 {var ar=this.get("axisRenderer"),style=ar.get("styles"),padding=style.padding,majorTicks=style.majorTicks,tickLength=majorTicks.length,display=majorTicks.display,pt={x:0,y:padding.top};if(display==="outside")
690 {pt.y+=tickLength;}
691 else if(display==="cross")
692 {pt.y+=tickLength/2;}
693 return pt;},drawTick:function(pt,tickStyles)
694 {var ar=this.get("axisRenderer"),style=ar.get("styles"),padding=style.padding,tickLength=tickStyles.length,start={x:pt.x,y:padding.top},end={x:pt.x,y:tickLength+padding.top};ar.drawLine(start,end,tickStyles);},getLabelPoint:function(pt)
695 {var ar=this.get("axisRenderer");return{x:pt.x,y:pt.y-ar.get("topTickOffset")};},updateMaxLabelSize:function(label)
696 {var ar=this.get("axisRenderer"),style=ar.get("styles").label,rot=Math.min(90,Math.max(-90,style.rotation)),absRot=Math.abs(rot),radCon=Math.PI/180,sinRadians=parseFloat(parseFloat(Math.sin(absRot*radCon)).toFixed(8)),cosRadians=parseFloat(parseFloat(Math.cos(absRot*radCon)).toFixed(8)),m11=cosRadians,m12=rot>0?-sinRadians:sinRadians,m21=-m12,m22=m11,max;if(!document.createElementNS)
697 {label.style.filter='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),label.offsetHeight));}
698 else
699 {label.style.msTransform="rotate(0deg)";if(rot===0)
700 {max=label.offsetHeight;}
701 else if(absRot===90)
702 {max=label.offsetWidth;}
703 else
704 {max=(sinRadians*label.offsetWidth)+(cosRadians*label.offsetHeight);}
705 this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),max));}},positionLabel:function(label,pt)
706 {var ar=this.get("axisRenderer"),tickOffset=ar.get("topTickOffset"),style=ar.get("styles").label,labelAlpha=style.alpha,filterString,margin=0,leftOffset=pt.x,topOffset=pt.y,rot=Math.max(-90,Math.min(90,style.rotation)),absRot=Math.abs(rot),radCon=Math.PI/180,sinRadians=parseFloat(parseFloat(Math.sin(absRot*radCon)).toFixed(8)),cosRadians=parseFloat(parseFloat(Math.cos(absRot*radCon)).toFixed(8)),m11,m12,m21,m22,maxLabelSize=this.get("maxLabelSize"),labelWidth=Math.round(label.offsetWidth),labelHeight=Math.round(label.offsetHeight);rot=Math.min(90,rot);rot=Math.max(-90,rot);if(style.margin&&style.margin.bottom)
707 {margin=style.margin.bottom;}
708 if(!document.createElementNS)
709 {label.style.filter=null;labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);m11=cosRadians;m12=rot>0?-sinRadians:sinRadians;m21=-m12;m22=m11;if(rot===0)
710 {leftOffset-=labelWidth*0.5;}
711 else if(absRot===90)
712 {leftOffset-=labelHeight*0.5;}
713 else if(rot>0)
714 {leftOffset-=(cosRadians*labelWidth)+Math.min((sinRadians*labelHeight),(rot/180*labelHeight));topOffset-=(sinRadians*labelWidth)+(cosRadians*(labelHeight));topOffset+=maxLabelSize;}
715 else
716 {leftOffset-=sinRadians*(labelHeight*0.5);topOffset-=(sinRadians*labelWidth)+(cosRadians*(labelHeight));topOffset+=maxLabelSize;}
717 topOffset-=tickOffset;label.style.left=leftOffset;label.style.top=topOffset;if(Y.Lang.isNumber(labelAlpha)&&labelAlpha<1&&labelAlpha>-1&&!isNaN(labelAlpha))
718 {filterString="progid:DXImageTransform.Microsoft.Alpha(Opacity="+Math.round(labelAlpha*100)+")";}
719 if(rot!==0)
720 {if(filterString)
721 {filterString+=" ";}
722 else
723 {filterString="";}
724 filterString+='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';}
725 if(filterString)
726 {label.style.filter=filterString;}
727 return;}
728 label.style.msTransform="rotate(0deg)";labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);if(rot===0)
729 {leftOffset-=labelWidth*0.5;topOffset-=labelHeight;}
730 else if(rot===90)
731 {leftOffset+=labelHeight*0.5;topOffset-=labelWidth;}
732 else if(rot===-90)
733 {leftOffset-=labelHeight*0.5;topOffset-=0;}
734 else if(rot<0)
735 {leftOffset-=(sinRadians*(labelHeight*0.6));topOffset-=(cosRadians*labelHeight);}
736 else
737 {leftOffset-=(cosRadians*labelWidth)-(sinRadians*(labelHeight*0.6));topOffset-=(sinRadians*labelWidth)+(cosRadians*labelHeight);}
738 topOffset-=tickOffset;label.style.left=leftOffset+"px";label.style.top=(this.get("maxLabelSize")+topOffset)+"px";label.style.MozTransformOrigin="0 0";label.style.MozTransform="rotate("+rot+"deg)";label.style.webkitTransformOrigin="0 0";label.style.webkitTransform="rotate("+rot+"deg)";label.style.msTransformOrigin="0 0";label.style.msTransform="rotate("+rot+"deg)";label.style.OTransformOrigin="0 0";label.style.OTransform="rotate("+rot+"deg)";},setSizeAndPosition:function()
739 {var labelSize=this.get("maxLabelSize"),ar=this.get("axisRenderer"),tickOffset=ar.get("topTickOffset"),style=ar.get("styles"),margin=style.label.margin,graphic=ar.get("graphic"),sz=tickOffset+labelSize;if(margin&&margin.bottom)
740 {sz+=margin.bottom;}
741 ar.set("height",sz);Y.one(graphic.node).setStyle("top",labelSize+margin.bottom);},offsetNodeForTick:function(cb)
742 {},setCalculatedSize:function()
743 {var ar=this.get("axisRenderer"),style=ar.get("styles").label,ttl=Math.round(ar.get("topTickOffset")+this.get("maxLabelSize")+style.margin.bottom);ar.set("height",ttl);}});Y.TopAxisLayout=TopAxisLayout;Y.AxisType=Y.Base.create("baseAxis",Y.Axis,[],{bindUI:function()
744 {this.after("dataReady",Y.bind(this._dataChangeHandler,this));this.after("dataUpdate",Y.bind(this._dataChangeHandler,this));this.after("minimumChange",Y.bind(this._keyChangeHandler,this));this.after("maximumChange",Y.bind(this._keyChangeHandler,this));this.after("keysChange",this._keyChangeHandler);this.after("dataProviderChange",this._dataProviderChangeHandler);this.after("stylesChange",this._updateHandler);this.after("positionChange",this._positionChangeHandler);this.after("overlapGraphChange",this._updateHandler);this.after("widthChange",this._handleSizeChange);this.after("heightChange",this._handleSizeChange);this.after("alwaysShowZeroChange",this._keyChangeHandler);this.after("roundingMethodChange",this._keyChangeHandler);},_dataProviderChangeHandler:function(e)
745 {var keyCollection=this.get("keyCollection").concat(),keys=this.get("keys"),i;if(keys)
746 {for(i in keys)
747 {if(keys.hasOwnProperty(i))
748 {delete keys[i];}}}
749 if(keyCollection&&keyCollection.length)
750 {this.set("keys",keyCollection);}},GUID:"yuibaseaxis",_type:null,_setMaximum:null,_dataMaximum:null,_setMinimum:null,_data:null,_updateTotalDataFlag:true,_dataReady:false,addKey:function(value)
751 {this.set("keys",value);},_getKeyArray:function(key,data)
752 {var i=0,obj,keyArray=[],len=data.length;for(;i<len;++i)
753 {obj=data[i];keyArray[i]=obj[key];}
754 return keyArray;},_setDataByKey:function(key,data)
755 {var i,obj,arr=[],dv=this._dataClone.concat(),len=dv.length;for(i=0;i<len;++i)
756 {obj=dv[i];arr[i]=obj[key];}
757 this.get("keys")[key]=arr;this._updateTotalDataFlag=true;},_updateTotalData:function()
758 {var keys=this.get("keys"),i;this._data=[];for(i in keys)
759 {if(keys.hasOwnProperty(i))
760 {this._data=this._data.concat(keys[i]);}}
761 this._updateTotalDataFlag=false;},removeKey:function(value)
762 {var keys=this.get("keys");if(keys.hasOwnProperty(value))
763 {delete keys[value];this._keyChangeHandler();}},getKeyValueAt:function(key,index)
764 {var value=NaN,keys=this.get("keys");if(keys[key]&&keys[key][index])
765 {value=keys[key][index];}
766 return value;},getDataByKey:function(value)
767 {var keys=this.get("keys");if(keys[value])
768 {return keys[value];}
769 return null;},_updateMinAndMax:function()
770 {var data=this.get("data"),max=0,min=0,len,num,i;if(data&&data.length&&data.length>0)
771 {len=data.length;max=min=data[0];if(len>1)
772 {for(i=1;i<len;i++)
773 {num=data[i];if(isNaN(num))
774 {continue;}
775 max=Math.max(num,max);min=Math.min(num,min);}}}
776 this._dataMaximum=max;this._dataMinimum=min;},getTotalMajorUnits:function()
777 {var units,majorUnit=this.get("styles").majorUnit,len=this.get("length");if(majorUnit.determinant==="count")
778 {units=majorUnit.count;}
779 else if(majorUnit.determinant==="distance")
780 {units=(len/majorUnit.distance)+1;}
781 return units;},getMajorUnitDistance:function(len,uiLen,majorUnit)
782 {var dist;if(majorUnit.determinant==="count")
783 {dist=uiLen/(len-1);}
784 else if(majorUnit.determinant==="distance")
785 {dist=majorUnit.distance;}
786 return dist;},getEdgeOffset:function(ct,l)
787 {return 0;},getLabelByIndex:function(i,l)
788 {var min=this.get("minimum"),max=this.get("maximum"),increm=(max-min)/(l-1),label;l-=1;label=min+(i*increm);return label;},_keyChangeHandler:function(e)
789 {this._updateMinAndMax();this.fire("dataUpdate");}},{ATTRS:{keys:{value:{},setter:function(val)
790 {var keys={},i,len,data=this.get("dataProvider");if(Y.Lang.isArray(val))
791 {len=val.length;for(i=0;i<len;++i)
792 {keys[val[i]]=this._getKeyArray(val[i],data);}}
793 else if(Y.Lang.isString(val))
794 {keys=this.get("keys");keys[val]=this._getKeyArray(val,data);}
795 else
796 {for(i in val)
797 {if(val.hasOwnProperty(i))
798 {keys[i]=this._getKeyArray(i,data);}}}
799 this._updateTotalDataFlag=true;return keys;}},roundingMethod:{value:"niceNumber"},type:{readOnly:true,getter:function()
800 {return this._type;}},dataProvider:{setter:function(value)
801 {return value;}},dataMaximum:{getter:function()
802 {if(!this._dataMaximum)
803 {this._updateMinAndMax();}
804 return this._dataMaximum;}},maximum:{getter:function()
805 {var max=this.get("dataMaximum");if(this.get("setMax"))
806 {max=this._setMaximum;}
807 return max;},setter:function(value)
808 {this._setMaximum=parseFloat(value);return value;}},dataMinimum:{getter:function()
809 {if(!this._dataMinimum)
810 {this._updateMinAndMax();}
811 return this._dataMinimum;}},minimum:{getter:function()
812 {var min=this.get("dataMinimum");if(this.get("setMin"))
813 {min=this._setMinimum;}
814 return min;},setter:function(val)
815 {this._setMinimum=parseFloat(val);return val;}},setMax:{readOnly:true,getter:function()
816 {return Y.Lang.isNumber(this._setMaximum);}},setMin:{readOnly:true,getter:function()
817 {return Y.Lang.isNumber(this._setMinimum);}},data:{getter:function()
818 {if(!this._data||this._updateTotalDataFlag)
819 {this._updateTotalData();}
820 return this._data;}},keyCollection:{getter:function()
821 {var keys=this.get("keys"),i,col=[];for(i in keys)
822 {if(keys.hasOwnProperty(i))
823 {col.push(i);}}
824 return col;},readOnly:true},labelFunction:{value:function(val,format)
825 {return val;}}}});function NumericAxis(config)
826 {NumericAxis.superclass.constructor.apply(this,arguments);}
827 NumericAxis.NAME="numericAxis";NumericAxis.ATTRS={alwaysShowZero:{value:true},labelFunction:{value:function(val,format)
828 {if(format)
829 {return Y.DataType.Number.format(val,format);}
830 return val;}},labelFormat:{value:{prefix:"",thousandsSeparator:"",decimalSeparator:"",decimalPlaces:"0",suffix:""}}};Y.extend(NumericAxis,Y.AxisType,{_type:"numeric",_getMinimumUnit:function(max,min,units)
831 {return this._getNiceNumber(Math.ceil((max-min)/units));},_getNiceNumber:function(roundingUnit)
832 {var tempMajorUnit=roundingUnit,order=Math.ceil(Math.log(tempMajorUnit)*0.4342944819032518),roundedMajorUnit=Math.pow(10,order),roundedDiff;if(roundedMajorUnit / 2>=tempMajorUnit)
833 {roundedDiff=Math.floor((roundedMajorUnit / 2-tempMajorUnit)/(Math.pow(10,order-1)/2));tempMajorUnit=roundedMajorUnit/2-roundedDiff*Math.pow(10,order-1)/2;}
834 else
835 {tempMajorUnit=roundedMajorUnit;}
836 if(!isNaN(tempMajorUnit))
837 {return tempMajorUnit;}
838 return roundingUnit;},_updateMinAndMax:function()
839 {var data=this.get("data"),max=0,min=0,len,num,i,key,setMax=this.get("setMax"),setMin=this.get("setMin");if(!setMax&&!setMin)
840 {if(data&&data.length&&data.length>0)
841 {len=data.length;max=min=data[0];if(len>1)
842 {for(i=1;i<len;i++)
843 {num=data[i];if(isNaN(num))
844 {if(Y.Lang.isObject(num))
845 {for(key in num)
846 {if(num.hasOwnProperty(key))
847 {max=Math.max(num[key],max);min=Math.min(num[key],min);}}}
848 continue;}
849 max=setMax?this._setMaximum:Math.max(num,max);min=setMin?this._setMinimum:Math.min(num,min);}}}
850 this._roundMinAndMax(min,max);}},_roundMinAndMax:function(min,max)
851 {var roundingUnit,minimumRange,minGreaterThanZero=min>=0,maxGreaterThanZero=max>0,dataRangeGreater,maxRound,minRound,topTicks,botTicks,tempMax,tempMin,units=this.getTotalMajorUnits()-1,alwaysShowZero=this.get("alwaysShowZero"),roundingMethod=this.get("roundingMethod"),useIntegers=(max-min)/units>=1;if(roundingMethod)
852 {if(roundingMethod=="niceNumber")
853 {roundingUnit=this._getMinimumUnit(max,min,units);if(minGreaterThanZero&&maxGreaterThanZero)
854 {if(alwaysShowZero||min<roundingUnit)
855 {min=0;}
856 roundingUnit=this._getMinimumUnit(max,min,units);max=this._roundUpToNearest(max,roundingUnit);}
857 else if(maxGreaterThanZero&&!minGreaterThanZero)
858 {topTicks=Math.round(units /((-1*min)/max+1));botTicks=units-topTicks;tempMax=Math.ceil(max/topTicks);tempMin=Math.floor(min/botTicks)*-1;roundingUnit=Math.max(tempMax,tempMin);roundingUnit=this._getNiceNumber(roundingUnit);max=roundingUnit*topTicks;min=roundingUnit*botTicks*-1;}
859 else
860 {if(alwaysShowZero||max===0||max+roundingUnit>0)
861 {max=0;roundingUnit=this._getMinimumUnit(max,min,units);}
862 else
863 {max=this._roundUpToNearest(max,roundingUnit);}
864 min=max-(roundingUnit*units);}}
865 else if(roundingMethod=="auto")
866 {if(minGreaterThanZero&&maxGreaterThanZero)
867 {if(alwaysShowZero||min<(max-min)/units)
868 {min=0;}
869 roundingUnit=(max-min)/units;if(useIntegers)
870 {roundingUnit=Math.ceil(roundingUnit);}
871 max=min+(roundingUnit*units);}
872 else if(maxGreaterThanZero&&!minGreaterThanZero)
873 {if(alwaysShowZero)
874 {topTicks=Math.round(units /((-1*min)/max+1));botTicks=units-topTicks;if(useIntegers)
875 {tempMax=Math.ceil(max/topTicks);tempMin=Math.floor(min/botTicks)*-1;}
876 else
877 {tempMax=max/topTicks;tempMin=min/botTicks*-1;}
878 roundingUnit=Math.max(tempMax,tempMin);max=roundingUnit*topTicks;min=roundingUnit*botTicks*-1;}
879 else
880 {roundingUnit=(max-min)/units;if(useIntegers)
881 {roundingUnit=Math.ceil(roundingUnit);}
882 min=this._roundDownToNearest(min,roundingUnit);max=this._roundUpToNearest(max,roundingUnit);}}
883 else
884 {roundingUnit=(max-min)/units;if(useIntegers)
885 {roundingUnit=Math.ceil(roundingUnit);}
886 if(alwaysShowZero||max===0||max+roundingUnit>0)
887 {max=0;roundingUnit=(max-min)/units;if(useIntegers)
888 {Math.ceil(roundingUnit);}}
889 else
890 {max=this._roundUpToNearest(max,roundingUnit);}
891 min=max-(roundingUnit*units);}}
892 else if(!isNaN(roundingMethod)&&isFinite(roundingMethod))
893 {roundingUnit=roundingMethod;minimumRange=roundingUnit*units;dataRangeGreater=(max-min)>minimumRange;minRound=this._roundDownToNearest(min,roundingUnit);maxRound=this._roundUpToNearest(max,roundingUnit);if(minGreaterThanZero&&maxGreaterThanZero)
894 {if(alwaysShowZero||minRound<=0)
895 {min=0;}
896 else
897 {min=minRound;}
898 if(!dataRangeGreater)
899 {max=min+minimumRange;}
900 else
901 {max=maxRound;}}
902 else if(maxGreaterThanZero&&!minGreaterThanZero)
903 {min=minRound;if(!dataRangeGreater)
904 {max=min+minimumRange;}
905 else
906 {max=maxRound;}}
907 else
908 {if(max===0||alwaysShowZero)
909 {max=0;}
910 else
911 {max=maxRound;}
912 if(!dataRangeGreater)
913 {min=max-minimumRange;}
914 else
915 {min=minRound;}}}}
916 this._dataMaximum=max;this._dataMinimum=min;},getLabelByIndex:function(i,l)
917 {var min=this.get("minimum"),max=this.get("maximum"),increm=(max-min)/(l-1),label;l-=1;label=min+(i*increm);if(i>0)
918 {label=this._roundToNearest(label,increm);}
919 return label;},_roundToNearest:function(number,nearest)
920 {nearest=nearest||1;if(nearest===0)
921 {return number;}
922 var roundedNumber=Math.round(this._roundToPrecision(number / nearest,10))*nearest;return this._roundToPrecision(roundedNumber,10);},_roundUpToNearest:function(number,nearest)
923 {nearest=nearest||1;if(nearest===0)
924 {return number;}
925 return Math.ceil(this._roundToPrecision(number / nearest,10))*nearest;},_roundDownToNearest:function(number,nearest)
926 {nearest=nearest||1;if(nearest===0)
927 {return number;}
928 return Math.floor(this._roundToPrecision(number / nearest,10))*nearest;},_roundToPrecision:function(number,precision)
929 {precision=precision||0;var decimalPlaces=Math.pow(10,precision);return Math.round(decimalPlaces*number)/ decimalPlaces;}});Y.NumericAxis=NumericAxis;function StackedAxis(config)
930 {StackedAxis.superclass.constructor.apply(this,arguments);}
931 StackedAxis.NAME="stackedAxis";Y.extend(StackedAxis,Y.NumericAxis,{_updateMinAndMax:function()
932 {var max=0,min=0,pos=0,neg=0,len=0,i=0,key,num,keys=this.get("keys");for(key in keys)
933 {if(keys.hasOwnProperty(key))
934 {len=Math.max(len,keys[key].length);}}
935 for(;i<len;++i)
936 {pos=0;neg=0;for(key in keys)
937 {if(keys.hasOwnProperty(key))
938 {num=keys[key][i];if(isNaN(num))
939 {continue;}
940 if(num>=0)
941 {pos+=num;}
942 else
943 {neg+=num;}}}
944 if(pos>0)
945 {max=Math.max(max,pos);}
946 else
947 {max=Math.max(max,neg);}
948 if(neg<0)
949 {min=Math.min(min,neg);}
950 else
951 {min=Math.min(min,pos);}}
952 this._roundMinAndMax(min,max);}});Y.StackedAxis=StackedAxis;function TimeAxis(config)
953 {TimeAxis.superclass.constructor.apply(this,arguments);}
954 TimeAxis.NAME="timeAxis";TimeAxis.ATTRS={setMax:{readOnly:true,getter:function()
955 {var max=this._getNumber(this._setMaximum);return(Y.Lang.isNumber(max));}},setMin:{readOnly:true,getter:function()
956 {var min=this._getNumber(this._setMinimum);return(Y.Lang.isNumber(min));}},maximum:{getter:function()
957 {var max=this._getNumber(this._setMaximum);if(!Y.Lang.isNumber(max))
958 {max=this._getNumber(this.get("dataMaximum"));}
959 return max;},setter:function(value)
960 {this._setMaximum=this._getNumber(value);return value;}},minimum:{getter:function()
961 {var min=this._getNumber(this._setMinimum);if(!Y.Lang.isNumber(min))
962 {min=this._getNumber(this.get("dataMinimum"));}
963 return min;},setter:function(value)
964 {this._setMinimum=this._getNumber(value);return value;}},labelFunction:{value:function(val,format)
965 {val=Y.DataType.Date.parse(val);if(format)
966 {return Y.DataType.Date.format(val,{format:format});}
967 return val;}},labelFormat:{value:"%b %d, %y"}};Y.extend(TimeAxis,Y.AxisType,{GUID:"yuitimeaxis",_dataType:"time",getLabelByIndex:function(i,l)
968 {var min=this.get("minimum"),max=this.get("maximum"),position=this.get("position"),increm,label;l-=1;increm=((max-min)/l)*i;if(position=="bottom"||position=="top")
969 {label=min+increm;}
970 else
971 {label=max-increm;}
972 return label;},_getKeyArray:function(key,data)
973 {var obj,keyArray=[],i=0,val,len=data.length;for(;i<len;++i)
974 {obj=data[i][key];if(Y.Lang.isDate(obj))
975 {val=obj.valueOf();}
976 else if(!Y.Lang.isNumber(obj))
977 {val=new Date(obj.toString()).valueOf();}
978 else
979 {val=obj;}
980 keyArray[i]=val;}
981 return keyArray;},_setDataByKey:function(key,data)
982 {var obj,arr=[],dv=this._dataClone.concat(),i,val,len=dv.length;for(i=0;i<len;++i)
983 {obj=dv[i][key];if(Y.Lang.isDate(obj))
984 {val=obj.valueOf();}
985 else if(!Y.Lang.isNumber(obj))
986 {val=new Date(obj.toString()).valueOf();}
987 else
988 {val=obj;}
989 arr[i]=val;}
990 this.get("keys")[key]=arr;this._updateTotalDataFlag=true;},_getNumber:function(val)
991 {if(Y.Lang.isDate(val))
992 {val=val.valueOf();}
993 else if(!Y.Lang.isNumber(val)&&val)
994 {val=new Date(val.toString()).valueOf();}
995 return val;}});Y.TimeAxis=TimeAxis;function CategoryAxis(config)
996 {CategoryAxis.superclass.constructor.apply(this,arguments);}
997 CategoryAxis.NAME="categoryAxis";Y.extend(CategoryAxis,Y.AxisType,{_indices:null,GUID:"yuicategoryaxis",_type:"category",_updateMinAndMax:function()
998 {this._dataMaximum=Math.max(this.get("data").length-1,0);this._dataMinimum=0;},_getKeyArray:function(key,data)
999 {var i=0,obj,keyArr=[],labels=[],len=data.length;if(!this._indices)
1000 {this._indices={};}
1001 for(;i<len;++i)
1002 {obj=data[i];keyArr[i]=i;labels[i]=obj[key];}
1003 this._indices[key]=keyArr;return labels;},_setDataByKey:function(key)
1004 {var i,obj,arr=[],labels=[],dv=this._dataClone.concat(),len=dv.length;if(!this._indices)
1005 {this._indices={};}
1006 for(i=0;i<len;++i)
1007 {obj=dv[i];arr[i]=i;labels[i]=obj[key];}
1008 this._indices[key]=arr;this.get("keys")[key]=labels.concat();this._updateTotalDataFlag=true;},getDataByKey:function(value)
1009 {if(!this._indices)
1010 {this.get("keys");}
1011 var keys=this._indices;if(keys[value])
1012 {return keys[value];}
1013 return null;},getTotalMajorUnits:function(majorUnit,len)
1014 {return this.get("data").length;},getMajorUnitDistance:function(len,uiLen,majorUnit)
1015 {var dist;if(majorUnit.determinant==="count")
1016 {dist=uiLen/len;}
1017 else if(majorUnit.determinant==="distance")
1018 {dist=majorUnit.distance;}
1019 return dist;},getEdgeOffset:function(ct,l)
1020 {return l/ct;},getLabelByIndex:function(i,l)
1021 {var label,data=this.get("data"),position=this.get("position");if(position=="bottom"||position=="top")
1022 {label=data[i];}
1023 else
1024 {label=data[l-(i+1)];}
1025 return label;}});Y.CategoryAxis=CategoryAxis;function CurveUtil()
1026 {}
1027 CurveUtil.prototype={getCurveControlPoints:function(xcoords,ycoords)
1028 {var outpoints=[],i=1,l=xcoords.length-1,xvals=[],yvals=[];if(l<1)
1029 {return null;}
1030 outpoints[0]={startx:xcoords[0],starty:ycoords[0],endx:xcoords[1],endy:ycoords[1]};if(l===1)
1031 {outpoints[0].ctrlx1=(2.0*xcoords[0]+xcoords[1])/3.0;outpoints[0].ctrly2=(2.0*ycoords[0]+ycoords[1])/3.0;outpoints[0].ctrlx2=2.0*outpoints[0].ctrlx1-xcoords[0];outpoints[0].ctrly2=2.0*outpoints[0].ctrly1-ycoords[0];return outpoints;}
1032 for(;i<l;++i)
1033 {outpoints.push({startx:Math.round(xcoords[i]),starty:Math.round(ycoords[i]),endx:Math.round(xcoords[i+1]),endy:Math.round(ycoords[i+1])});xvals[i]=4.0*xcoords[i]+2*xcoords[i+1];yvals[i]=4.0*ycoords[i]+2*ycoords[i+1];}
1034 xvals[0]=xcoords[0]+(2.0*xcoords[1]);xvals[l-1]=(8.0*xcoords[l-1]+xcoords[l])/ 2.0;xvals=this.getControlPoints(xvals.concat());yvals[0]=ycoords[0]+(2.0*ycoords[1]);yvals[l-1]=(8.0*ycoords[l-1]+ycoords[l])/ 2.0;yvals=this.getControlPoints(yvals.concat());for(i=0;i<l;++i)
1035 {outpoints[i].ctrlx1=Math.round(xvals[i]);outpoints[i].ctrly1=Math.round(yvals[i]);if(i<l-1)
1036 {outpoints[i].ctrlx2=Math.round(2*xcoords[i+1]-xvals[i+1]);outpoints[i].ctrly2=Math.round(2*ycoords[i+1]-yvals[i+1]);}
1037 else
1038 {outpoints[i].ctrlx2=Math.round((xcoords[l]+xvals[l-1])/2);outpoints[i].ctrly2=Math.round((ycoords[l]+yvals[l-1])/2);}}
1039 return outpoints;},getControlPoints:function(vals)
1040 {var l=vals.length,x=[],tmp=[],b=2.0,i=1;x[0]=vals[0]/ b;for(;i<l;++i)
1041 {tmp[i]=1/b;b=(i<l-1?4.0:3.5)-tmp[i];x[i]=(vals[i]-x[i-1])/ b;}
1042 for(i=1;i<l;++i)
1043 {x[l-i-1]-=tmp[l-i]*x[l-i];}
1044 return x;}};Y.CurveUtil=CurveUtil;function StackingUtil(){}
1045 StackingUtil.prototype={_stackCoordinates:function()
1046 {var direction=this.get("direction"),order=this.get("order"),type=this.get("type"),graph=this.get("graph"),h=graph.get("height"),seriesCollection=graph.seriesTypes[type],i=0,len,xcoords=this.get("xcoords"),ycoords=this.get("ycoords"),prevXCoords,prevYCoords;if(order===0)
1047 {return;}
1048 prevXCoords=seriesCollection[order-1].get("xcoords").concat();prevYCoords=seriesCollection[order-1].get("ycoords").concat();if(direction==="vertical")
1049 {len=prevXCoords.length;for(;i<len;++i)
1050 {if(!isNaN(prevXCoords[i])&&!isNaN(xcoords[i]))
1051 {xcoords[i]+=prevXCoords[i];}}}
1052 else
1053 {len=prevYCoords.length;for(;i<len;++i)
1054 {if(!isNaN(prevYCoords[i])&&!isNaN(ycoords[i]))
1055 {ycoords[i]=prevYCoords[i]-(h-ycoords[i]);}}}}};Y.StackingUtil=StackingUtil;function Lines(){}
1056 Lines.prototype={_lineDefaults:null,_getGraphic:function()
1057 {var graph=this.get("graph");if(!this._lineGraphic)
1058 {this._lineGraphic=new Y.Graphic();this._lineGraphic.render(graph.get("contentBox"));}
1059 this._lineGraphic.clear();this._lineGraphic.setSize(graph.get("width"),graph.get("height"));this.autoSize=false;return this._lineGraphic;},drawLines:function()
1060 {if(this.get("xcoords").length<1)
1061 {return;}
1062 var xcoords=this.get("xcoords").concat(),ycoords=this.get("ycoords").concat(),direction=this.get("direction"),len=direction==="vertical"?ycoords.length:xcoords.length,lastX,lastY,lastValidX=lastX,lastValidY=lastY,nextX,nextY,i,styles=this.get("styles").line,lineType=styles.lineType,lc=styles.color||this._getDefaultColor(this.get("graphOrder"),"line"),lineAlpha=styles.alpha,dashLength=styles.dashLength,gapSpace=styles.gapSpace,connectDiscontinuousPoints=styles.connectDiscontinuousPoints,discontinuousType=styles.discontinuousType,discontinuousDashLength=styles.discontinuousDashLength,discontinuousGapSpace=styles.discontinuousGapSpace,graphic=this._getGraphic();lastX=lastValidX=xcoords[0];lastY=lastValidY=ycoords[0];graphic.lineStyle(styles.weight,lc,lineAlpha);graphic.moveTo(lastX,lastY);for(i=1;i<len;i=++i)
1063 {nextX=xcoords[i];nextY=ycoords[i];if(isNaN(nextY))
1064 {lastValidX=nextX;lastValidY=nextY;continue;}
1065 if(lastValidX==lastX)
1066 {if(lineType!="dashed")
1067 {graphic.lineTo(nextX,nextY);}
1068 else
1069 {this.drawDashedLine(lastValidX,lastValidY,nextX,nextY,dashLength,gapSpace);}}
1070 else if(!connectDiscontinuousPoints)
1071 {graphic.moveTo(nextX,nextY);}
1072 else
1073 {if(discontinuousType!="solid")
1074 {this.drawDashedLine(lastValidX,lastValidY,nextX,nextY,discontinuousDashLength,discontinuousGapSpace);}
1075 else
1076 {graphic.lineTo(nextX,nextY);}}
1077 lastX=lastValidX=nextX;lastY=lastValidY=nextY;}
1078 graphic.end();},drawSpline:function()
1079 {if(this.get("xcoords").length<1)
1080 {return;}
1081 var xcoords=this.get("xcoords"),ycoords=this.get("ycoords"),curvecoords=this.getCurveControlPoints(xcoords,ycoords),len=curvecoords.length,cx1,cx2,cy1,cy2,x,y,i=0,styles=this.get("styles").line,graphic=this._getGraphic(),lineAlpha=styles.alpha,color=styles.color||this._getDefaultColor(this.get("graphOrder"),"line");graphic.lineStyle(styles.weight,color,lineAlpha);graphic.moveTo(xcoords[0],ycoords[0]);for(;i<len;i=++i)
1082 {x=curvecoords[i].endx;y=curvecoords[i].endy;cx1=curvecoords[i].ctrlx1;cx2=curvecoords[i].ctrlx2;cy1=curvecoords[i].ctrly1;cy2=curvecoords[i].ctrly2;graphic.curveTo(cx1,cy1,cx2,cy2,x,y);}
1083 graphic.end();},drawDashedLine:function(xStart,yStart,xEnd,yEnd,dashSize,gapSize)
1084 {dashSize=dashSize||10;gapSize=gapSize||10;var segmentLength=dashSize+gapSize,xDelta=xEnd-xStart,yDelta=yEnd-yStart,delta=Math.sqrt(Math.pow(xDelta,2)+Math.pow(yDelta,2)),segmentCount=Math.floor(Math.abs(delta / segmentLength)),radians=Math.atan2(yDelta,xDelta),xCurrent=xStart,yCurrent=yStart,i,graphic=this._getGraphic();xDelta=Math.cos(radians)*segmentLength;yDelta=Math.sin(radians)*segmentLength;for(i=0;i<segmentCount;++i)
1085 {graphic.moveTo(xCurrent,yCurrent);graphic.lineTo(xCurrent+Math.cos(radians)*dashSize,yCurrent+Math.sin(radians)*dashSize);xCurrent+=xDelta;yCurrent+=yDelta;}
1086 graphic.moveTo(xCurrent,yCurrent);delta=Math.sqrt((xEnd-xCurrent)*(xEnd-xCurrent)+(yEnd-yCurrent)*(yEnd-yCurrent));if(delta>dashSize)
1087 {graphic.lineTo(xCurrent+Math.cos(radians)*dashSize,yCurrent+Math.sin(radians)*dashSize);}
1088 else if(delta>0)
1089 {graphic.lineTo(xCurrent+Math.cos(radians)*delta,yCurrent+Math.sin(radians)*delta);}
1090 graphic.moveTo(xEnd,yEnd);},_getLineDefaults:function()
1091 {return{alpha:1,weight:6,lineType:"solid",dashLength:10,gapSpace:10,connectDiscontinuousPoints:true,discontinuousType:"solid",discontinuousDashLength:10,discontinuousGapSpace:10};}};Y.augment(Lines,Y.Attribute);Y.Lines=Lines;function Fills(cfg)
1092 {var attrs={area:{getter:function()
1093 {return this._defaults||this._getAreaDefaults();},setter:function(val)
1094 {var defaults=this._defaults||this._getAreaDefaults();this._defaults=Y.merge(defaults,val);}}};this.addAttrs(attrs,cfg);this.get("styles");}
1095 Fills.prototype={drawFill:function(xcoords,ycoords)
1096 {if(xcoords.length<1)
1097 {return;}
1098 var len=xcoords.length,firstX=xcoords[0],firstY=ycoords[0],lastValidX=firstX,lastValidY=firstY,nextX,nextY,i=1,styles=this.get("styles").area,graphic=this.get("graphic"),color=styles.color||this._getDefaultColor(this.get("graphOrder"),"slice");graphic.clear();graphic.beginFill(color,styles.alpha);graphic.moveTo(firstX,firstY);for(;i<len;i=++i)
1099 {nextX=xcoords[i];nextY=ycoords[i];if(isNaN(nextY))
1100 {lastValidX=nextX;lastValidY=nextY;continue;}
1101 graphic.lineTo(nextX,nextY);lastValidX=nextX;lastValidY=nextY;}
1102 graphic.end();},drawAreaSpline:function()
1103 {if(this.get("xcoords").length<1)
1104 {return;}
1105 var xcoords=this.get("xcoords"),ycoords=this.get("ycoords"),curvecoords=this.getCurveControlPoints(xcoords,ycoords),len=curvecoords.length,cx1,cx2,cy1,cy2,x,y,i=0,firstX=xcoords[0],firstY=ycoords[0],styles=this.get("styles").area,graphic=this.get("graphic"),color=styles.color||this._getDefaultColor(this.get("graphOrder"),"slice");graphic.beginFill(color,styles.alpha);graphic.moveTo(firstX,firstY);for(;i<len;i=++i)
1106 {x=curvecoords[i].endx;y=curvecoords[i].endy;cx1=curvecoords[i].ctrlx1;cx2=curvecoords[i].ctrlx2;cy1=curvecoords[i].ctrly1;cy2=curvecoords[i].ctrly2;graphic.curveTo(cx1,cy1,cx2,cy2,x,y);}
1107 if(this.get("direction")==="vertical")
1108 {graphic.lineTo(this._leftOrigin,y);graphic.lineTo(this._leftOrigin,firstY);}
1109 else
1110 {graphic.lineTo(x,this._bottomOrigin);graphic.lineTo(firstX,this._bottomOrigin);}
1111 graphic.lineTo(firstX,firstY);graphic.end();},drawStackedAreaSpline:function()
1112 {if(this.get("xcoords").length<1)
1113 {return;}
1114 var xcoords=this.get("xcoords"),ycoords=this.get("ycoords"),curvecoords,order=this.get("order"),type=this.get("type"),graph=this.get("graph"),seriesCollection=graph.seriesTypes[type],prevXCoords,prevYCoords,len,cx1,cx2,cy1,cy2,x,y,i=0,firstX,firstY,styles=this.get("styles").area,graphic=this.get("graphic"),color=styles.color||this._getDefaultColor(this.get("graphOrder"),"slice");firstX=xcoords[0];firstY=ycoords[0];curvecoords=this.getCurveControlPoints(xcoords,ycoords);len=curvecoords.length;graphic.beginFill(color,styles.alpha);graphic.moveTo(firstX,firstY);for(;i<len;i=++i)
1115 {x=curvecoords[i].endx;y=curvecoords[i].endy;cx1=curvecoords[i].ctrlx1;cx2=curvecoords[i].ctrlx2;cy1=curvecoords[i].ctrly1;cy2=curvecoords[i].ctrly2;graphic.curveTo(cx1,cy1,cx2,cy2,x,y);}
1116 if(order>0)
1117 {prevXCoords=seriesCollection[order-1].get("xcoords").concat().reverse();prevYCoords=seriesCollection[order-1].get("ycoords").concat().reverse();curvecoords=this.getCurveControlPoints(prevXCoords,prevYCoords);i=0;len=curvecoords.length;graphic.lineTo(prevXCoords[0],prevYCoords[0]);for(;i<len;i=++i)
1118 {x=curvecoords[i].endx;y=curvecoords[i].endy;cx1=curvecoords[i].ctrlx1;cx2=curvecoords[i].ctrlx2;cy1=curvecoords[i].ctrly1;cy2=curvecoords[i].ctrly2;graphic.curveTo(cx1,cy1,cx2,cy2,x,y);}}
1119 else
1120 {if(this.get("direction")==="vertical")
1121 {graphic.lineTo(this._leftOrigin,ycoords[ycoords.length-1]);graphic.lineTo(this._leftOrigin,firstY);}
1122 else
1123 {graphic.lineTo(xcoords[xcoords.length-1],this._bottomOrigin);graphic.lineTo(firstX,this._bottomOrigin);}}
1124 graphic.lineTo(firstX,firstY);graphic.end();},_defaults:null,_getClosingPoints:function()
1125 {var xcoords=this.get("xcoords").concat(),ycoords=this.get("ycoords").concat();if(this.get("direction")==="vertical")
1126 {xcoords.push(this._leftOrigin);xcoords.push(this._leftOrigin);ycoords.push(ycoords[ycoords.length-1]);ycoords.push(ycoords[0]);}
1127 else
1128 {xcoords.push(xcoords[xcoords.length-1]);xcoords.push(xcoords[0]);ycoords.push(this._bottomOrigin);ycoords.push(this._bottomOrigin);}
1129 xcoords.push(xcoords[0]);ycoords.push(ycoords[0]);return[xcoords,ycoords];},_getStackedClosingPoints:function()
1130 {var order=this.get("order"),type=this.get("type"),graph=this.get("graph"),direction=this.get("direction"),seriesCollection=graph.seriesTypes[type],prevXCoords,prevYCoords,allXCoords=this.get("xcoords").concat(),allYCoords=this.get("ycoords").concat(),firstX=allXCoords[0],firstY=allYCoords[0];if(order>0)
1131 {prevXCoords=seriesCollection[order-1].get("xcoords").concat();prevYCoords=seriesCollection[order-1].get("ycoords").concat();allXCoords=allXCoords.concat(prevXCoords.concat().reverse());allYCoords=allYCoords.concat(prevYCoords.concat().reverse());allXCoords.push(allXCoords[0]);allYCoords.push(allYCoords[0]);}
1132 else
1133 {if(direction==="vertical")
1134 {allXCoords.push(this._leftOrigin);allXCoords.push(this._leftOrigin);allYCoords.push(allYCoords[allYCoords.length-1]);allYCoords.push(firstY);}
1135 else
1136 {allXCoords.push(allXCoords[allXCoords.length-1]);allXCoords.push(firstX);allYCoords.push(this._bottomOrigin);allYCoords.push(this._bottomOrigin);}}
1137 return[allXCoords,allYCoords];},_getAreaDefaults:function()
1138 {return{};}};Y.augment(Fills,Y.Attribute);Y.Fills=Fills;function Plots(cfg)
1139 {var attrs={markers:{getter:function()
1140 {return this._markers;}}};this.addAttrs(attrs,cfg);}
1141 Plots.prototype={_plotDefaults:null,drawPlots:function()
1142 {if(!this.get("xcoords")||this.get("xcoords").length<1)
1143 {return;}
1144 var style=Y.clone(this.get("styles").marker),w=style.width,h=style.height,xcoords=this.get("xcoords"),ycoords=this.get("ycoords"),i=0,len=xcoords.length,top=ycoords[0],left,marker,offsetWidth=w/2,offsetHeight=h/2,fillColors=null,borderColors=null,graphOrder=this.get("graphOrder"),hotspot,isChrome=ISCHROME;if(Y.Lang.isArray(style.fill.color))
1145 {fillColors=style.fill.color.concat();}
1146 if(Y.Lang.isArray(style.border.color))
1147 {borderColors=style.border.colors.concat();}
1148 this._createMarkerCache();if(isChrome)
1149 {this._createHotspotCache();}
1150 for(;i<len;++i)
1151 {top=(ycoords[i]-offsetHeight);left=(xcoords[i]-offsetWidth);if(!top||!left||top===undefined||left===undefined||top=="undefined"||left=="undefined"||isNaN(top)||isNaN(left))
1152 {this._markers.push(null);this._graphicNodes.push(null);continue;}
1153 if(fillColors)
1154 {style.fill.color=fillColors[i%fillColors.length];}
1155 if(borderColors)
1156 {style.border.colors=borderColors[i%borderColors.length];}
1157 marker=this.getMarker(style,graphOrder,i);marker.setPosition(left,top);if(isChrome)
1158 {hotspot=this.getHotspot(style,graphOrder,i);hotspot.setPosition(left,top);hotspot.parentNode.style.zIndex=5;}}
1159 this._clearMarkerCache();if(isChrome)
1160 {this._clearHotspotCache();}},_getPlotDefaults:function()
1161 {var defs={fill:{type:"solid",alpha:1,colors:null,alphas:null,ratios:null},border:{weight:1,alpha:1},width:10,height:10,shape:"circle"};defs.fill.color=this._getDefaultColor(this.get("graphOrder"),"fill");defs.border.color=this._getDefaultColor(this.get("graphOrder"),"border");return defs;},_markers:null,_markerCache:null,getMarker:function(styles,order,index)
1162 {var marker;if(this._markerCache.length>0)
1163 {while(!marker)
1164 {if(this._markerCache.length<1)
1165 {marker=this._createMarker(styles,order,index);break;}
1166 marker=this._markerCache.shift();}
1167 marker.update(styles);}
1168 else
1169 {marker=this._createMarker(styles,order,index);}
1170 this._markers.push(marker);this._graphicNodes.push(marker.parentNode);return marker;},_createMarker:function(styles,order,index)
1171 {var graphic=new Y.Graphic(),marker,cfg=Y.clone(styles);graphic.render(this.get("graph").get("contentBox"));graphic.node.setAttribute("id","markerParent_"+order+"_"+index);cfg.graphic=graphic;marker=new Y.Shape(cfg);marker.addClass("yui3-seriesmarker");marker.node.setAttribute("id","series_"+order+"_"+index);return marker;},_createMarkerCache:function()
1172 {if(this._markers&&this._markers.length>0)
1173 {this._markerCache=this._markers.concat();}
1174 else
1175 {this._markerCache=[];}
1176 this._markers=[];this._graphicNodes=[];},_clearMarkerCache:function()
1177 {var len=this._markerCache.length,i=0,graphic,marker;for(;i<len;++i)
1178 {marker=this._markerCache[i];if(marker)
1179 {graphic=marker.graphics;graphic.destroy();}}
1180 this._markerCache=[];},updateMarkerState:function(type,i)
1181 {if(this._markers[i])
1182 {var w,h,markerStyles,styles=Y.clone(this.get("styles").marker),state=this._getState(type),xcoords=this.get("xcoords"),ycoords=this.get("ycoords"),marker=this._markers[i],graphicNode=marker.parentNode;markerStyles=state=="off"||!styles[state]?styles:styles[state];markerStyles.fill.color=this._getItemColor(markerStyles.fill.color,i);markerStyles.border.color=this._getItemColor(markerStyles.border.color,i);marker.update(markerStyles);w=markerStyles.width;h=markerStyles.height;graphicNode.style.left=(xcoords[i]-w/2)+"px";graphicNode.style.top=(ycoords[i]-h/2)+"px";marker.toggleVisible(this.get("visible"));}},_getItemColor:function(val,i)
1183 {if(Y.Lang.isArray(val))
1184 {return val[i%val.length];}
1185 return val;},_setStyles:function(val)
1186 {val=this._parseMarkerStyles(val);return Y.Renderer.prototype._setStyles.apply(this,[val]);},_parseMarkerStyles:function(val)
1187 {if(val.marker)
1188 {var defs=this._getPlotDefaults();val.marker=this._mergeStyles(val.marker,defs);if(val.marker.over)
1189 {val.marker.over=this._mergeStyles(val.marker.over,val.marker);}
1190 if(val.marker.down)
1191 {val.marker.down=this._mergeStyles(val.marker.down,val.marker);}}
1192 return val;},_getState:function(type)
1193 {var state;switch(type)
1194 {case"mouseout":state="off";break;case"mouseover":state="over";break;case"mouseup":state="over";break;case"mousedown":state="down";break;}
1195 return state;},_stateSyles:null,_hotspots:null,_hotspotCache:null,getHotspot:function(hotspotStyles,order,index)
1196 {var hotspot,styles=Y.clone(hotspotStyles);styles.fill={type:"solid",color:"#000",alpha:0};styles.border={weight:0};if(this._hotspotCache.length>0)
1197 {while(!hotspot)
1198 {if(this._hotspotCache.length<1)
1199 {hotspot=this._createHotspot(styles,order,index);break;}
1200 hotspot=this._hotspotCache.shift();}
1201 hotspot.update(styles);}
1202 else
1203 {hotspot=this._createHotspot(styles,order,index);}
1204 this._hotspots.push(hotspot);return hotspot;},_createHotspot:function(styles,order,index)
1205 {var graphic=new Y.Graphic(),hotspot,cfg=Y.clone(styles);graphic.render(this.get("graph").get("contentBox"));graphic.node.setAttribute("id","hotspotParent_"+order+"_"+index);cfg.graphic=graphic;hotspot=new Y.Shape(cfg);hotspot.addClass("yui3-seriesmarker");hotspot.node.setAttribute("id","hotspot_"+order+"_"+index);return hotspot;},_createHotspotCache:function()
1206 {if(this._hotspots&&this._hotspots.length>0)
1207 {this._hotspotCache=this._hotspots.concat();}
1208 else
1209 {this._hotspotCache=[];}
1210 this._hotspots=[];},_clearHotspotCache:function()
1211 {var len=this._hotspotCache.length,i=0,graphic,hotspot;for(;i<len;++i)
1212 {hotspot=this._hotspotCache[i];if(hotspot)
1213 {graphic=hotspot.graphics;graphic.destroy();}}
1214 this._hotspotCache=[];}};Y.augment(Plots,Y.Attribute);Y.Plots=Plots;function Histogram(){}
1215 Histogram.prototype={drawSeries:function()
1216 {if(this.get("xcoords").length<1)
1217 {return;}
1218 var style=Y.clone(this.get("styles").marker),setSize,calculatedSize,xcoords=this.get("xcoords"),ycoords=this.get("ycoords"),i=0,len=xcoords.length,top=ycoords[0],type=this.get("type"),graph=this.get("graph"),seriesCollection=graph.seriesTypes[type],seriesLen=seriesCollection.length,seriesSize=0,totalSize=0,offset=0,ratio,renderer,order=this.get("order"),graphOrder=this.get("graphOrder"),left,marker,setSizeKey,calculatedSizeKey,config,fillColors=null,borderColors=null,hotspot,isChrome=ISCHROME;if(Y.Lang.isArray(style.fill.color))
1219 {fillColors=style.fill.color.concat();}
1220 if(Y.Lang.isArray(style.border.color))
1221 {borderColors=style.border.colors.concat();}
1222 if(this.get("direction")=="vertical")
1223 {setSizeKey="height";calculatedSizeKey="width";}
1224 else
1225 {setSizeKey="width";calculatedSizeKey="height";}
1226 setSize=style[setSizeKey];calculatedSize=style[calculatedSizeKey];this._createMarkerCache();if(isChrome)
1227 {this._createHotspotCache();}
1228 for(;i<seriesLen;++i)
1229 {renderer=seriesCollection[i];seriesSize+=renderer.get("styles").marker[setSizeKey];if(order>i)
1230 {offset=seriesSize;}}
1231 totalSize=len*seriesSize;if(totalSize>graph.get(setSizeKey))
1232 {ratio=graph.get(setSizeKey)/totalSize;seriesSize*=ratio;offset*=ratio;setSize*=ratio;setSize=Math.max(setSize,1);}
1233 offset-=seriesSize/2;for(i=0;i<len;++i)
1234 {config=this._getMarkerDimensions(xcoords[i],ycoords[i],calculatedSize,offset);top=config.top;calculatedSize=config.calculatedSize;left=config.left;style[setSizeKey]=setSize;style[calculatedSizeKey]=calculatedSize;if(fillColors)
1235 {style.fill.color=fillColors[i%fillColors.length];}
1236 if(borderColors)
1237 {style.border.colors=borderColors[i%borderColors.length];}
1238 marker=this.getMarker(style,graphOrder,i);marker.setPosition(left,top);if(isChrome)
1239 {hotspot=this.getHotspot(style,graphOrder,i);hotspot.setPosition(left,top);hotspot.parentNode.style.zIndex=5;}}
1240 this._clearMarkerCache();if(isChrome)
1241 {this._clearHotspotCache();}},_defaultFillColors:["#66007f","#a86f41","#295454","#996ab2","#e8cdb7","#90bdbd","#000000","#c3b8ca","#968373","#678585"],_getPlotDefaults:function()
1242 {var defs={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}};defs.fill.color=this._getDefaultColor(this.get("graphOrder"),"fill");defs.border.color=this._getDefaultColor(this.get("graphOrder"),"border");return defs;}};Y.Histogram=Histogram;Y.CartesianSeries=Y.Base.create("cartesianSeries",Y.Base,[Y.Renderer],{_xDisplayName:null,_yDisplayName:null,_leftOrigin:null,_bottomOrigin:null,render:function()
1243 {this._setCanvas();this.addListeners();this.set("rendered",true);this.validate();},addListeners:function()
1244 {var xAxis=this.get("xAxis"),yAxis=this.get("yAxis");if(xAxis)
1245 {xAxis.after("dataReady",Y.bind(this._xDataChangeHandler,this));xAxis.after("dataUpdate",Y.bind(this._xDataChangeHandler,this));}
1246 if(yAxis)
1247 {yAxis.after("dataReady",Y.bind(this._yDataChangeHandler,this));yAxis.after("dataUpdate",Y.bind(this._yDataChangeHandler,this));}
1248 this.after("xAxisChange",this._xAxisChangeHandler);this.after("yAxisChange",this._yAxisChangeHandler);this.after("stylesChange",function(e){var axesReady=this._updateAxisData();if(axesReady)
1249 {this.draw();}});this.after("widthChange",function(e){var axesReady=this._updateAxisData();if(axesReady)
1250 {this.draw();}});this.after("heightChange",function(e){var axesReady=this._updateAxisData();if(axesReady)
1251 {this.draw();}});this.after("visibleChange",this._toggleVisible);},_xAxisChangeHandler:function(e)
1252 {var xAxis=this.get("xAxis");xAxis.after("dataReady",Y.bind(this._xDataChangeHandler,this));xAxis.after("dataUpdate",Y.bind(this._xDataChangeHandler,this));},_yAxisChangeHandler:function(e)
1253 {var yAxis=this.get("yAxis");yAxis.after("dataReady",Y.bind(this._yDataChangeHandler,this));yAxis.after("dataUpdate",Y.bind(this._yDataChangeHandler,this));},GUID:"yuicartesianseries",_xDataChangeHandler:function(event)
1254 {var axesReady=this._updateAxisData();if(axesReady)
1255 {this.draw();}},_yDataChangeHandler:function(event)
1256 {var axesReady=this._updateAxisData();if(axesReady)
1257 {this.draw();}},_updateAxisData:function()
1258 {var xAxis=this.get("xAxis"),yAxis=this.get("yAxis"),xKey=this.get("xKey"),yKey=this.get("yKey"),yData,xData;if(!xAxis||!yAxis||!xKey||!yKey)
1259 {return false;}
1260 xData=xAxis.getDataByKey(xKey);yData=yAxis.getDataByKey(yKey);if(!xData||!yData)
1261 {return false;}
1262 this.set("xData",xData.concat());this.set("yData",yData.concat());return true;},validate:function()
1263 {if((this.get("xData")&&this.get("yData"))||this._updateAxisData())
1264 {this.draw();}},_setCanvas:function()
1265 {this.set("graphic",new Y.Graphic());this.get("graphic").render(this.get("graph").get("contentBox"));},setAreaData:function()
1266 {var nextX,nextY,graph=this.get("graph"),w=graph.get("width"),h=graph.get("height"),xAxis=this.get("xAxis"),yAxis=this.get("yAxis"),xData=this.get("xData").concat(),yData=this.get("yData").concat(),xOffset=xAxis.getEdgeOffset(xData.length,w),yOffset=yAxis.getEdgeOffset(yData.length,h),padding=this.get("styles").padding,leftPadding=padding.left,topPadding=padding.top,dataWidth=w-(leftPadding+padding.right+xOffset),dataHeight=h-(topPadding+padding.bottom+yOffset),xcoords=[],ycoords=[],xMax=xAxis.get("maximum"),xMin=xAxis.get("minimum"),yMax=yAxis.get("maximum"),yMin=yAxis.get("minimum"),xScaleFactor=dataWidth /(xMax-xMin),yScaleFactor=dataHeight /(yMax-yMin),dataLength,direction=this.get("direction"),i=0,xMarkerPlane=[],yMarkerPlane=[],xMarkerPlaneOffset=this.get("xMarkerPlaneOffset"),yMarkerPlaneOffset=this.get("yMarkerPlaneOffset"),graphic=this.get("graphic");dataLength=xData.length;xOffset*=0.5;yOffset*=0.5;if(direction==="vertical")
1267 {yData=yData.reverse();}
1268 if(graphic)
1269 {graphic.setSize(w,h);}
1270 this._leftOrigin=Math.round(((0-xMin)*xScaleFactor)+leftPadding+xOffset);this._bottomOrigin=Math.round((dataHeight+topPadding+yOffset)-(0-yMin)*yScaleFactor);for(;i<dataLength;++i)
1271 {nextX=Math.round((((xData[i]-xMin)*xScaleFactor)+leftPadding+xOffset));nextY=Math.round(((dataHeight+topPadding+yOffset)-(yData[i]-yMin)*yScaleFactor));xcoords.push(nextX);ycoords.push(nextY);xMarkerPlane.push({start:nextX-xMarkerPlaneOffset,end:nextX+xMarkerPlaneOffset});yMarkerPlane.push({start:nextY-yMarkerPlaneOffset,end:nextY+yMarkerPlaneOffset});}
1272 this.set("xcoords",xcoords);this.set("ycoords",ycoords);this.set("xMarkerPlane",xMarkerPlane);this.set("yMarkerPlane",yMarkerPlane);},draw:function()
1273 {var graph=this.get("graph"),w=graph.get("width"),h=graph.get("height");if(this.get("rendered"))
1274 {if((isFinite(w)&&isFinite(h)&&w>0&&h>0)&&((this.get("xData")&&this.get("yData"))||this._updateAxisData()))
1275 {if(this._drawing)
1276 {this._callLater=true;return;}
1277 this._drawing=true;this._callLater=false;this.setAreaData();if(this.get("xcoords")&&this.get("ycoords"))
1278 {this.drawSeries();}
1279 this._drawing=false;if(this._callLater)
1280 {this.draw();}
1281 else
1282 {this._toggleVisible(this.get("visible"));this.fire("drawingComplete");}}}},_defaultPlaneOffset:4,_getDefaultStyles:function()
1283 {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(index,type)
1284 {var colors={line:this._defaultLineColors,fill:this._defaultFillColors,border:this._defaultBorderColors,slice:this._defaultSliceColors},col=colors[type],l=col.length;index=index||0;if(index>=l)
1285 {index=index%l;}
1286 type=type||"fill";return colors[type][index];},_toggleVisible:function(e)
1287 {var graphic=this.get("graphic"),markers=this.get("markers"),i=0,len,visible=this.get("visible"),marker;if(graphic)
1288 {graphic.toggleVisible(visible);}
1289 if(markers)
1290 {len=markers.length;for(;i<len;++i)
1291 {marker=markers[i];if(marker)
1292 {marker.toggleVisible(visible);}}}
1293 if(this._lineGraphic)
1294 {this._lineGraphic.toggleVisible(visible);}}},{ATTRS:{xDisplayName:{getter:function()
1295 {return this._xDisplayName||this.get("xKey");},setter:function(val)
1296 {this._xDisplayName=val;return val;}},yDisplayName:{getter:function()
1297 {return this._yDisplayName||this.get("yKey");},setter:function(val)
1298 {this._yDisplayName=val;return val;}},categoryDisplayName:{readOnly:true,getter:function()
1299 {return this.get("direction")=="vertical"?this.get("yDisplayName"):this.get("xDisplayName");}},valueDisplayName:{readOnly:true,getter:function()
1300 {return this.get("direction")=="vertical"?this.get("xDisplayName"):this.get("yDisplayName");}},type:{value:"cartesian"},order:{},graphOrder:{},xcoords:{},ycoords:{},graph:{},xAxis:{},yAxis:{},xKey:{},yKey:{},xData:{},yData:{},rendered:{value:false},width:{readOnly:true,getter:function()
1301 {this.get("graph").get("width");}},height:{readOnly:true,getter:function()
1302 {this.get("graph").get("height");}},visible:{value:true},xMarkerPlane:{},yMarkerPlane:{},xMarkerPlaneOffset:{getter:function(){var marker=this.get("styles").marker;if(marker&&marker.width&&isFinite(marker.width))
1303 {return marker.width*0.5;}
1304 return this._defaultPlaneOffset;}},yMarkerPlaneOffset:{getter:function(){var marker=this.get("styles").marker;if(marker&&marker.height&&isFinite(marker.height))
1305 {return marker.height*0.5;}
1306 return this._defaultPlaneOffset;}},direction:{value:"horizontal"}}});Y.MarkerSeries=Y.Base.create("markerSeries",Y.CartesianSeries,[Y.Plots],{renderUI:function()
1307 {this._setNode();},drawSeries:function()
1308 {this.drawPlots();},_setStyles:function(val)
1309 {if(!val.marker)
1310 {val={marker:val};}
1311 val=this._parseMarkerStyles(val);return Y.MarkerSeries.superclass._mergeStyles.apply(this,[val,this._getDefaultStyles()]);},_getDefaultStyles:function()
1312 {var styles=this._mergeStyles({marker:this._getPlotDefaults()},Y.MarkerSeries.superclass._getDefaultStyles());return styles;}},{ATTRS:{type:{value:"marker"}}});Y.LineSeries=Y.Base.create("lineSeries",Y.CartesianSeries,[Y.Lines],{drawSeries:function()
1313 {this.get("graphic").clear();this.drawLines();},_setStyles:function(val)
1314 {if(!val.line)
1315 {val={line:val};}
1316 return Y.LineSeries.superclass._setStyles.apply(this,[val]);},_getDefaultStyles:function()
1317 {var styles=this._mergeStyles({line:this._getLineDefaults()},Y.LineSeries.superclass._getDefaultStyles());return styles;}},{ATTRS:{type:{value:"line"}}});Y.SplineSeries=Y.Base.create("splineSeries",Y.CartesianSeries,[Y.CurveUtil,Y.Lines],{drawSeries:function()
1318 {this.get("graphic").clear();this.drawSpline();}},{ATTRS:{type:{value:"spline"}}});Y.AreaSplineSeries=Y.Base.create("areaSplineSeries",Y.CartesianSeries,[Y.Fills,Y.CurveUtil],{drawSeries:function()
1319 {this.get("graphic").clear();this.drawAreaSpline();}},{ATTRS:{type:{value:"areaSpline"}}});Y.StackedSplineSeries=Y.Base.create("stackedSplineSeries",Y.SplineSeries,[Y.StackingUtil],{setAreaData:function()
1320 {Y.StackedSplineSeries.superclass.setAreaData.apply(this);this._stackCoordinates.apply(this);}},{ATTRS:{type:{value:"stackedSpline"}}});Y.StackedMarkerSeries=Y.Base.create("stackedMarkerSeries",Y.MarkerSeries,[Y.StackingUtil],{setAreaData:function()
1321 {Y.StackedMarkerSeries.superclass.setAreaData.apply(this);this._stackCoordinates.apply(this);}},{ATTRS:{type:{value:"stackedMarker"}}});Y.ColumnSeries=Y.Base.create("columnSeries",Y.MarkerSeries,[Y.Histogram],{_getMarkerDimensions:function(xcoord,ycoord,calculatedSize,offset)
1322 {var config={top:ycoord,left:xcoord+offset};config.calculatedSize=this._bottomOrigin-config.top;return config;},updateMarkerState:function(type,i)
1323 {if(this._markers[i])
1324 {var styles=Y.clone(this.get("styles").marker),markerStyles,state=this._getState(type),xcoords=this.get("xcoords"),ycoords=this.get("ycoords"),marker=this._markers[i],graph=this.get("graph"),seriesCollection=graph.seriesTypes[this.get("type")],seriesLen=seriesCollection.length,seriesSize=0,offset=0,renderer,n=0,xs=[],order=this.get("order");markerStyles=state=="off"||!styles[state]?styles:styles[state];markerStyles.fill.color=this._getItemColor(markerStyles.fill.color,i);markerStyles.border.color=this._getItemColor(markerStyles.border.color,i);markerStyles.height=this._bottomOrigin-ycoords[i];marker.update(markerStyles);for(;n<seriesLen;++n)
1325 {renderer=seriesCollection[n].get("markers")[i];xs[n]=xcoords[i]+seriesSize;seriesSize+=renderer.width;if(order>n)
1326 {offset=seriesSize;}
1327 offset-=seriesSize/2;}
1328 for(n=0;n<seriesLen;++n)
1329 {renderer=Y.one(seriesCollection[n]._graphicNodes[i]);renderer.setStyle("left",(xs[n]-seriesSize/2)+"px");}}}},{ATTRS:{type:{value:"column"}}});Y.BarSeries=Y.Base.create("barSeries",Y.MarkerSeries,[Y.Histogram],{renderUI:function()
1330 {this._setNode();},_getMarkerDimensions:function(xcoord,ycoord,calculatedSize,offset)
1331 {var config={top:ycoord+offset,left:this._leftOrigin};config.calculatedSize=xcoord-config.left;return config;},updateMarkerState:function(type,i)
1332 {if(this._markers[i])
1333 {var styles=Y.clone(this.get("styles").marker),markerStyles,state=this._getState(type),xcoords=this.get("xcoords"),ycoords=this.get("ycoords"),marker=this._markers[i],graph=this.get("graph"),seriesCollection=graph.seriesTypes[this.get("type")],seriesLen=seriesCollection.length,seriesSize=0,offset=0,renderer,n=0,ys=[],order=this.get("order");markerStyles=state=="off"||!styles[state]?styles:styles[state];markerStyles.fill.color=this._getItemColor(markerStyles.fill.color,i);markerStyles.border.color=this._getItemColor(markerStyles.border.color,i);markerStyles.width=(xcoords[i]-this._leftOrigin);marker.update(markerStyles);for(;n<seriesLen;++n)
1334 {renderer=seriesCollection[n].get("markers")[i];ys[n]=ycoords[i]+seriesSize;seriesSize+=renderer.height;if(order>n)
1335 {offset=seriesSize;}
1336 offset-=seriesSize/2;}
1337 for(n=0;n<seriesLen;++n)
1338 {renderer=Y.one(seriesCollection[n]._graphicNodes[i]);renderer.setStyle("top",(ys[n]-seriesSize/2));}}}},{ATTRS:{type:{value:"bar"},direction:{value:"vertical"}}});Y.AreaSeries=Y.Base.create("areaSeries",Y.CartesianSeries,[Y.Fills],{drawSeries:function()
1339 {this.get("graphic").clear();this.drawFill.apply(this,this._getClosingPoints());},_setStyles:function(val)
1340 {if(!val.area)
1341 {val={area:val};}
1342 return Y.AreaSeries.superclass._setStyles.apply(this,[val]);},_getDefaultStyles:function()
1343 {var styles=this._mergeStyles({area:this._getAreaDefaults()},Y.AreaSeries.superclass._getDefaultStyles());return styles;}},{ATTRS:{type:{value:"area"}}});Y.StackedAreaSplineSeries=Y.Base.create("stackedAreaSplineSeries",Y.AreaSeries,[Y.CurveUtil,Y.StackingUtil],{drawSeries:function()
1344 {this.get("graphic").clear();this._stackCoordinates();this.drawStackedAreaSpline();}},{ATTRS:{type:{value:"stackedAreaSpline"}}});Y.ComboSeries=Y.Base.create("comboSeries",Y.CartesianSeries,[Y.Fills,Y.Lines,Y.Plots],{drawSeries:function()
1345 {this.get("graphic").clear();if(this.get("showAreaFill"))
1346 {this.drawFill.apply(this,this._getClosingPoints());}
1347 if(this.get("showLines"))
1348 {this.drawLines();}
1349 if(this.get("showMarkers"))
1350 {this.drawPlots();}},_getDefaultStyles:function()
1351 {var styles=Y.ComboSeries.superclass._getDefaultStyles();styles.line=this._getLineDefaults();styles.marker=this._getPlotDefaults();styles.area=this._getAreaDefaults();return styles;}},{ATTRS:{type:{value:"combo"},showAreaFill:{value:false},showLines:{value:true},showMarkers:{value:true},marker:{lazyAdd:false,getter:function()
1352 {return this.get("styles").marker;},setter:function(val)
1353 {this.set("styles",{marker:val});}},line:{lazyAdd:false,getter:function()
1354 {return this.get("styles").line;},setter:function(val)
1355 {this.set("styles",{line:val});}},area:{lazyAdd:false,getter:function()
1356 {return this.get("styles").area;},setter:function(val)
1357 {this.set("styles",{area:val});}}}});Y.StackedComboSeries=Y.Base.create("stackedComboSeries",Y.ComboSeries,[Y.StackingUtil],{setAreaData:function()
1358 {Y.StackedComboSeries.superclass.setAreaData.apply(this);this._stackCoordinates.apply(this);},drawSeries:function()
1359 {this.get("graphic").clear();if(this.get("showAreaFill"))
1360 {this.drawFill.apply(this,this._getStackedClosingPoints());}
1361 if(this.get("showLines"))
1362 {this.drawLines();}
1363 if(this.get("showMarkers"))
1364 {this.drawPlots();}}},{ATTRS:{type:{value:"stackedCombo"},showAreaFill:{value:true}}});Y.ComboSplineSeries=Y.Base.create("comboSplineSeries",Y.ComboSeries,[Y.CurveUtil],{drawSeries:function()
1365 {this.get("graphic").clear();if(this.get("showAreaFill"))
1366 {this.drawAreaSpline();}
1367 if(this.get("showLines"))
1368 {this.drawSpline();}
1369 if(this.get("showMarkers"))
1370 {this.drawPlots();}}},{ATTRS:{type:{value:"comboSpline"}}});Y.StackedComboSplineSeries=Y.Base.create("stackedComboSplineSeries",Y.StackedComboSeries,[Y.CurveUtil],{drawSeries:function()
1371 {this.get("graphic").clear();if(this.get("showAreaFill"))
1372 {this.drawStackedAreaSpline();}
1373 if(this.get("showLines"))
1374 {this.drawSpline();}
1375 if(this.get("showMarkers"))
1376 {this.drawPlots();}}},{ATTRS:{type:{value:"stackedComboSpline"},showAreaFill:{value:true}}});Y.StackedLineSeries=Y.Base.create("stackedLineSeries",Y.LineSeries,[Y.StackingUtil],{setAreaData:function()
1377 {Y.StackedLineSeries.superclass.setAreaData.apply(this);this._stackCoordinates.apply(this);}},{ATTRS:{type:{value:"stackedLine"}}});Y.StackedAreaSeries=Y.Base.create("stackedAreaSeries",Y.AreaSeries,[Y.StackingUtil],{setAreaData:function()
1378 {Y.StackedAreaSeries.superclass.setAreaData.apply(this);this._stackCoordinates.apply(this);},drawSeries:function()
1379 {this.get("graphic").clear();this.drawFill.apply(this,this._getStackedClosingPoints());}},{ATTRS:{type:{value:"stackedArea"}}});Y.StackedColumnSeries=Y.Base.create("stackedColumnSeries",Y.ColumnSeries,[Y.StackingUtil],{drawSeries:function()
1380 {if(this.get("xcoords").length<1)
1381 {return;}
1382 var style=this.get("styles").marker,w=style.width,h=style.height,xcoords=this.get("xcoords"),ycoords=this.get("ycoords"),i=0,len=xcoords.length,top=ycoords[0],type=this.get("type"),graph=this.get("graph"),seriesCollection=graph.seriesTypes[type],ratio,order=this.get("order"),graphOrder=this.get("graphOrder"),left,marker,lastCollection,negativeBaseValues,positiveBaseValues,useOrigin=order===0,totalWidth=len*w,hotspot,isChrome=ISCHROME;this._createMarkerCache();if(isChrome)
1383 {this._createHotspotCache();}
1384 if(totalWidth>this.get("width"))
1385 {ratio=this.width/totalWidth;w*=ratio;w=Math.max(w,1);}
1386 if(!useOrigin)
1387 {lastCollection=seriesCollection[order-1];negativeBaseValues=lastCollection.get("negativeBaseValues");positiveBaseValues=lastCollection.get("positiveBaseValues");}
1388 else
1389 {negativeBaseValues=[];positiveBaseValues=[];}
1390 this.set("negativeBaseValues",negativeBaseValues);this.set("positiveBaseValues",positiveBaseValues);for(i=0;i<len;++i)
1391 {top=ycoords[i];if(useOrigin)
1392 {h=this._bottomOrigin-top;if(top<this._bottomOrigin)
1393 {positiveBaseValues[i]=top;negativeBaseValues[i]=this._bottomOrigin;}
1394 else if(top>this._bottomOrigin)
1395 {positiveBaseValues[i]=this._bottomOrigin;negativeBaseValues[i]=top;}
1396 else
1397 {positiveBaseValues[i]=top;negativeBaseValues[i]=top;}}
1398 else
1399 {if(top>this._bottomOrigin)
1400 {top+=(negativeBaseValues[i]-this._bottomOrigin);h=negativeBaseValues[i]-top;negativeBaseValues[i]=top;}
1401 else if(top<this._bottomOrigin)
1402 {top=positiveBaseValues[i]-(this._bottomOrigin-ycoords[i]);h=positiveBaseValues[i]-top;positiveBaseValues[i]=top;}}
1403 left=xcoords[i]-w/2;style.width=w;style.height=h;marker=this.getMarker(style,graphOrder,i);marker.setPosition(left,top);if(isChrome)
1404 {hotspot=this.getHotspot(style,graphOrder,i);hotspot.setPosition(left,top);hotspot.parentNode.style.zIndex=5;}}
1405 this._clearMarkerCache();if(isChrome)
1406 {this._clearHotspotCache();}},updateMarkerState:function(type,i)
1407 {if(this._markers[i])
1408 {var styles,markerStyles,state=this._getState(type),xcoords=this.get("xcoords"),marker=this._markers[i],offset=0;styles=this.get("styles").marker;markerStyles=state=="off"||!styles[state]?styles:styles[state];markerStyles.height=marker.height;marker.update(markerStyles);offset=styles.width*0.5;if(marker.parentNode)
1409 {Y.one(marker.parentNode).setStyle("left",(xcoords[i]-offset));}}},_getPlotDefaults:function()
1410 {var defs={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}};defs.fill.color=this._getDefaultColor(this.get("graphOrder"),"fill");defs.border.color=this._getDefaultColor(this.get("graphOrder"),"border");return defs;}},{ATTRS:{type:{value:"stackedColumn"},negativeBaseValues:{value:null},positiveBaseValues:{value:null}}});Y.StackedBarSeries=Y.Base.create("stackedBarSeries",Y.BarSeries,[Y.StackingUtil],{drawSeries:function()
1411 {if(this.get("xcoords").length<1)
1412 {return;}
1413 var style=this.get("styles").marker,w=style.width,h=style.height,xcoords=this.get("xcoords"),ycoords=this.get("ycoords"),i=0,len=xcoords.length,top=ycoords[0],type=this.get("type"),graph=this.get("graph"),seriesCollection=graph.seriesTypes[type],ratio,order=this.get("order"),graphOrder=this.get("graphOrder"),left,marker,lastCollection,negativeBaseValues,positiveBaseValues,useOrigin=order===0,totalHeight=len*h,hotspot,isChrome=ISCHROME;this._createMarkerCache();if(isChrome)
1414 {this._createHotspotCache();}
1415 if(totalHeight>this.get("height"))
1416 {ratio=this.height/totalHeight;h*=ratio;h=Math.max(h,1);}
1417 if(!useOrigin)
1418 {lastCollection=seriesCollection[order-1];negativeBaseValues=lastCollection.get("negativeBaseValues");positiveBaseValues=lastCollection.get("positiveBaseValues");}
1419 else
1420 {negativeBaseValues=[];positiveBaseValues=[];}
1421 this.set("negativeBaseValues",negativeBaseValues);this.set("positiveBaseValues",positiveBaseValues);for(i=0;i<len;++i)
1422 {top=ycoords[i];left=xcoords[i];if(useOrigin)
1423 {w=left-this._leftOrigin;if(left>this._leftOrigin)
1424 {positiveBaseValues[i]=left;negativeBaseValues[i]=this._leftOrigin;}
1425 else if(left<this._leftOrigin)
1426 {positiveBaseValues[i]=this._leftOrigin;negativeBaseValues[i]=left;}
1427 else
1428 {positiveBaseValues[i]=left;negativeBaseValues[i]=this._leftOrigin;}
1429 left-=w;}
1430 else
1431 {if(left<this._leftOrigin)
1432 {left=negativeBaseValues[i]-(this._leftOrigin-xcoords[i]);w=negativeBaseValues[i]-left;negativeBaseValues[i]=left;}
1433 else if(left>this._leftOrigin)
1434 {left+=(positiveBaseValues[i]-this._leftOrigin);w=left-positiveBaseValues[i];positiveBaseValues[i]=left;left-=w;}}
1435 top-=h/2;style.width=w;style.height=h;marker=this.getMarker(style,graphOrder,i);marker.setPosition(left,top);if(isChrome)
1436 {hotspot=this.getHotspot(style,graphOrder,i);hotspot.setPosition(left,top);hotspot.parentNode.style.zIndex=5;}}
1437 this._clearMarkerCache();if(isChrome)
1438 {this._clearHotspotCache();}},updateMarkerState:function(type,i)
1439 {if(this._markers[i])
1440 {var state=this._getState(type),ycoords=this.get("ycoords"),marker=this._markers[i],styles=this.get("styles").marker,h=styles.height,markerStyles=state=="off"||!styles[state]?styles:styles[state];markerStyles.width=marker.width;marker.update(markerStyles);if(marker.parentNode)
1441 {Y.one(marker.parentNode).setStyle("top",(ycoords[i]-h/2));}}},_getPlotDefaults:function()
1442 {var defs={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}};defs.fill.color=this._getDefaultColor(this.get("graphOrder"),"fill");defs.border.color=this._getDefaultColor(this.get("graphOrder"),"border");return defs;}},{ATTRS:{type:{value:"stackedBar"},direction:{value:"vertical"},negativeBaseValues:{value:null},positiveBaseValues:{value:null}}});Y.PieSeries=Y.Base.create("pieSeries",Y.MarkerSeries,[],{_map:null,_image:null,_setMap:function()
1443 {var id="pieHotSpotMapi_"+Math.round(100000*Math.random()),cb=this.get("graph").get("contentBox"),areaNode;if(this._image)
1444 {cb.removeChild(this._image);while(this._areaNodes&&this._areaNodes.length>0)
1445 {areaNode=this._areaNodes.shift();this._map.removeChild(areaNode);}
1446 cb.removeChild(this._map);}
1447 this._image=document.createElement("img");this._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAABCAYAAAD9yd/wAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABJJREFUeNpiZGBgSGPAAgACDAAIkABoFyloZQAAAABJRU5ErkJggg==";cb.appendChild(this._image);this._image.setAttribute("usemap","#"+id);this._image.style.zIndex=3;this._image.style.opacity=0;this._image.setAttribute("alt","imagemap");this._map=document.createElement("map");this._map.style.zIndex=5;cb.appendChild(this._map);this._map.setAttribute("name",id);this._map.setAttribute("id",id);this._areaNodes=[];},_categoryDisplayName:null,_valueDisplayName:null,addListeners:function()
1448 {var categoryAxis=this.get("categoryAxis"),valueAxis=this.get("valueAxis");if(categoryAxis)
1449 {categoryAxis.after("dataReady",Y.bind(this._categoryDataChangeHandler,this));categoryAxis.after("dataUpdate",Y.bind(this._categoryDataChangeHandler,this));}
1450 if(valueAxis)
1451 {valueAxis.after("dataReady",Y.bind(this._valueDataChangeHandler,this));valueAxis.after("dataUpdate",Y.bind(this._valueDataChangeHandler,this));}
1452 this.after("categoryAxisChange",this.categoryAxisChangeHandler);this.after("valueAxisChange",this.valueAxisChangeHandler);this.after("stylesChange",this._updateHandler);},validate:function()
1453 {this.draw();this._renderered=true;},_categoryAxisChangeHandler:function(e)
1454 {var categoryAxis=this.get("categoryAxis");categoryAxis.after("dataReady",Y.bind(this._categoryDataChangeHandler,this));categoryAxis.after("dataUpdate",Y.bind(this._categoryDataChangeHandler,this));},_valueAxisChangeHandler:function(e)
1455 {var valueAxis=this.get("valueAxis");valueAxis.after("dataReady",Y.bind(this._valueDataChangeHandler,this));valueAxis.after("dataUpdate",Y.bind(this._valueDataChangeHandler,this));},GUID:"pieseries",_categoryDataChangeHandler:function(event)
1456 {if(this._rendered&&this.get("categoryKey")&&this.get("valueKey"))
1457 {this.draw();}},_valueDataChangeHandler:function(event)
1458 {if(this._rendered&&this.get("categoryKey")&&this.get("valueKey"))
1459 {this.draw();}},draw:function()
1460 {var graph=this.get("graph"),w=graph.get("width"),h=graph.get("height");if(isFinite(w)&&isFinite(h)&&w>0&&h>0)
1461 {this._rendered=true;this.drawSeries();this.fire("drawingComplete");}},drawPlots:function()
1462 {var values=this.get("valueAxis").getDataByKey(this.get("valueKey")).concat(),catValues=this.get("categoryAxis").getDataByKey(this.get("categoryKey")).concat(),totalValue=0,itemCount=values.length,styles=this.get("styles").marker,fillColors=styles.fill.colors,fillAlphas=styles.fill.alphas||["1"],borderColors=styles.border.colors,borderWeights=[styles.border.weight],borderAlphas=[styles.border.alpha],tbw=borderWeights.concat(),tbc=borderColors.concat(),tba=borderAlphas.concat(),tfc,tfa,padding=styles.padding,graph=this.get("graph"),w=graph.get("width")-(padding.left+padding.right),h=graph.get("height")-(padding.top+padding.bottom),startAngle=-90,halfWidth=w / 2,halfHeight=h / 2,radius=Math.min(halfWidth,halfHeight),i=0,value,angle=0,lc,la,lw,wedgeStyle,marker,graphOrder=this.get("graphOrder"),isCanvas=DRAWINGAPI=="canvas";for(;i<itemCount;++i)
1463 {value=values[i];values.push(value);if(!isNaN(value))
1464 {totalValue+=value;}}
1465 tfc=fillColors?fillColors.concat():null;tfa=fillAlphas?fillAlphas.concat():null;this._createMarkerCache();if(isCanvas)
1466 {this._setMap();this._image.width=w;this._image.height=h;}
1467 for(i=0;i<itemCount;i++)
1468 {value=values[i];if(totalValue===0)
1469 {angle=360 / values.length;}
1470 else
1471 {angle=360*(value / totalValue);}
1472 angle=Math.round(angle);if(tfc&&tfc.length<1)
1473 {tfc=fillColors.concat();}
1474 if(tfa&&tfa.length<1)
1475 {tfa=fillAlphas.concat();}
1476 if(tbw&&tbw.length<1)
1477 {tbw=borderWeights.concat();}
1478 if(tbw&&tbc.length<1)
1479 {tbc=borderColors.concat();}
1480 if(tba&&tba.length<1)
1481 {tba=borderAlphas.concat();}
1482 lw=tbw?tbw.shift():null;lc=tbc?tbc.shift():null;la=tba?tba.shift():null;startAngle+=angle;wedgeStyle={border:{color:lc,weight:lw,alpha:la},fill:{color:tfc?tfc.shift():this._getDefaultColor(i,"slice"),alpha:tfa?tfa.shift():null},shape:"wedge",props:{arc:angle,radius:radius,startAngle:startAngle,x:halfWidth,y:halfHeight},width:w,height:h};marker=this.getMarker(wedgeStyle,graphOrder,i);if(isCanvas)
1483 {this._addHotspot(wedgeStyle.props,graphOrder,i);}}
1484 this._clearMarkerCache();},_addHotspot:function(cfg,seriesIndex,index)
1485 {var areaNode=document.createElement("area"),i=1,x=cfg.x,y=cfg.y,arc=cfg.arc,startAngle=cfg.startAngle-arc,endAngle=cfg.startAngle,radius=cfg.radius,ax=x+Math.cos(startAngle / 180*Math.PI)*radius,ay=y+Math.sin(startAngle / 180*Math.PI)*radius,bx=x+Math.cos(endAngle / 180*Math.PI)*radius,by=y+Math.sin(endAngle / 180*Math.PI)*radius,numPoints=Math.floor(arc/10)-1,divAngle=(arc/(Math.floor(arc/10))/ 180)*Math.PI,angleCoord=Math.atan((ay-y)/(ax-x)),pts=x+", "+y+", "+ax+", "+ay,cosAng,sinAng,multDivAng;for(i=1;i<=numPoints;++i)
1486 {multDivAng=divAngle*i;cosAng=Math.cos(angleCoord+multDivAng);sinAng=Math.sin(angleCoord+multDivAng);if(startAngle<=90)
1487 {pts+=", "+(x+(radius*Math.cos(angleCoord+(divAngle*i))));pts+=", "+(y+(radius*Math.sin(angleCoord+(divAngle*i))));}
1488 else
1489 {pts+=", "+(x-(radius*Math.cos(angleCoord+(divAngle*i))));pts+=", "+(y-(radius*Math.sin(angleCoord+(divAngle*i))));}}
1490 pts+=", "+bx+", "+by;pts+=", "+x+", "+y;this._map.appendChild(areaNode);areaNode.setAttribute("class","yui3-seriesmarker");areaNode.setAttribute("id","hotSpot_"+seriesIndex+"_"+index);areaNode.setAttribute("shape","polygon");areaNode.setAttribute("coords",pts);this._areaNodes.push(areaNode);},updateMarkerState:function(type,i)
1491 {if(this._markers[i])
1492 {var state=this._getState(type),markerStyles,indexStyles,marker=this._markers[i],styles=this.get("styles").marker;markerStyles=state=="off"||!styles[state]?styles:styles[state];indexStyles=this._mergeStyles(markerStyles,{});indexStyles.fill.color=indexStyles.fill.colors[i%indexStyles.fill.colors.length];indexStyles.fill.alpha=indexStyles.fill.alphas[i%indexStyles.fill.alphas.length];marker.update(indexStyles);}},_createMarker:function(styles,order,index)
1493 {var cfg=Y.clone(styles),marker;cfg.graphic=this.get("graphic");marker=new Y.Shape(cfg);marker.addClass("yui3-seriesmarker");marker.node.setAttribute("id","series_"+order+"_"+index);return marker;},_clearMarkerCache:function()
1494 {var len=this._markerCache.length,i=0,marker;for(;i<len;++i)
1495 {marker=this._markerCache[i];if(marker&&marker.node&&marker.parentNode)
1496 {marker.parentNode.removeChild(marker.node);}}
1497 this._markerCache=[];},_getPlotDefaults:function()
1498 {var defs={padding:{top:0,left:0,right:0,bottom:0},fill:{alphas:["1"]},border:{weight:0,alpha:1}};defs.fill.colors=this._defaultSliceColors;defs.border.colors=this._defaultBorderColors;return defs;},_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(index,type)
1499 {var colors={line:this._defaultLineColors,fill:this._defaultFillColors,border:this._defaultBorderColors,slice:this._defaultSliceColors},col=colors[type],l=col.length;index=index||0;if(index>=l)
1500 {index=index%l;}
1501 type=type||"fill";return colors[type][index];}},{ATTRS:{type:{value:"pie"},order:{},graph:{},categoryAxis:{value:null,validator:function(value)
1502 {return value!==this.get("categoryAxis");}},valueAxis:{value:null,validator:function(value)
1503 {return value!==this.get("valueAxis");}},categoryKey:{value:null,validator:function(value)
1504 {return value!==this.get("categoryKey");}},valueKey:{value:null,validator:function(value)
1505 {return value!==this.get("valueKey");}},categoryDisplayName:{setter:function(val)
1506 {this._categoryDisplayName=val;return val;},getter:function()
1507 {return this._categoryDisplayName||this.get("categoryKey");}},valueDisplayName:{setter:function(val)
1508 {this._valueDisplayName=val;return val;},getter:function()
1509 {return this._valueDisplayName||this.get("valueKey");}},slices:null}});Y.Gridlines=Y.Base.create("gridlines",Y.Base,[Y.Renderer],{render:function()
1510 {this._setCanvas();},remove:function()
1511 {var graphic=this.get("graphic"),gNode;if(graphic)
1512 {gNode=graphic.node;if(gNode)
1513 {Y.one(gNode).remove();}}},draw:function()
1514 {if(this.get("axis")&&this.get("graph"))
1515 {this._drawGridlines();}},_drawGridlines:function()
1516 {var graphic=this.get("graphic"),axis=this.get("axis"),axisPosition=axis.get("position"),points,i=0,l,direction=this.get("direction"),graph=this.get("graph"),w=graph.get("width"),h=graph.get("height"),line=this.get("styles").line,color=line.color,weight=line.weight,alpha=line.alpha,lineFunction=direction=="vertical"?this._verticalLine:this._horizontalLine;if(axisPosition=="none")
1517 {points=[];l=axis.get("styles").majorUnit.count;for(;i<l;++i)
1518 {points[i]={x:w*(i/(l-1)),y:h*(i/(l-1))};}
1519 i=0;}
1520 else
1521 {points=axis.get("tickPoints");l=points.length;}
1522 if(!graphic)
1523 {this._setCanvas();graphic=this.get("graphic");}
1524 graphic.clear();graphic.setSize(w,h);graphic.lineStyle(weight,color,alpha);for(;i<l;++i)
1525 {lineFunction(graphic,points[i],w,h);}
1526 graphic.end();},_horizontalLine:function(graphic,pt,w,h)
1527 {graphic.moveTo(0,pt.y);graphic.lineTo(w,pt.y);},_verticalLine:function(graphic,pt,w,h)
1528 {graphic.moveTo(pt.x,0);graphic.lineTo(pt.x,h);},_setCanvas:function()
1529 {this.set("graphic",new Y.Graphic());this.get("graphic").render(this.get("graph").get("contentBox"));},_getDefaultStyles:function()
1530 {var defs={line:{color:"#f0efe9",weight:1,alpha:1}};return defs;}},{ATTRS:{direction:{},axis:{},graph:{}}});Y.Graph=Y.Base.create("graph",Y.Widget,[Y.Renderer],{bindUI:function()
1531 {var bb=this.get("boundingBox");bb.setStyle("position","absolute");this.after("widthChange",this._sizeChangeHandler);this.after("heightChange",this._sizeChangeHandler);this.after("stylesChange",this._updateStyles);},syncUI:function()
1532 {if(this.get("showBackground"))
1533 {var graphic=new Y.Graphic(),graphicNode,cb=this.get("contentBox"),bg=this.get("styles").background,border=bg.border,weight=border.weight||0,w=this.get("width"),h=this.get("height");if(w)
1534 {w+=weight*2;bg.width=w;}
1535 if(h)
1536 {h+=weight*2;bg.height=h;}
1537 graphic.render(cb);this._background=graphic.getShape(bg);graphicNode=Y.one(graphic.node);graphicNode.setStyle("left",0-weight);graphicNode.setStyle("top",0-weight);graphicNode.setStyle("zIndex",-1);}},renderUI:function()
1538 {var sc=this.get("seriesCollection"),series,i=0,len=sc.length,hgl=this.get("horizontalGridlines"),vgl=this.get("verticalGridlines");for(;i<len;++i)
1539 {series=sc[i];if(series instanceof Y.CartesianSeries)
1540 {series.render();}}
1541 if(hgl&&hgl instanceof Y.Gridlines)
1542 {hgl.draw();}
1543 if(vgl&&vgl instanceof Y.Gridlines)
1544 {vgl.draw();}},seriesTypes:null,getSeriesByIndex:function(val)
1545 {var col=this.get("seriesCollection"),series;if(col&&col.length>val)
1546 {series=col[val];}
1547 return series;},getSeriesByKey:function(val)
1548 {var obj=this._seriesDictionary,series;if(obj&&obj.hasOwnProperty(val))
1549 {series=obj[val];}
1550 return series;},addDispatcher:function(val)
1551 {if(!this._dispatchers)
1552 {this._dispatchers=[];}
1553 this._dispatchers.push(val);},_seriesCollection:null,_seriesDictionary:null,_parseSeriesCollection:function(val)
1554 {if(!val)
1555 {return;}
1556 var len=val.length,i=0,series,seriesKey;if(!this.get("seriesCollection"))
1557 {this._seriesCollection=[];}
1558 if(!this._seriesDictionary)
1559 {this._seriesDictionary={};}
1560 if(!this.seriesTypes)
1561 {this.seriesTypes=[];}
1562 for(;i<len;++i)
1563 {series=val[i];if(!(series instanceof Y.CartesianSeries)&&!(series instanceof Y.PieSeries))
1564 {this._createSeries(series);continue;}
1565 this._addSeries(series);}
1566 len=this.get("seriesCollection").length;for(i=0;i<len;++i)
1567 {series=this.get("seriesCollection")[i];seriesKey=series.get("direction")=="horizontal"?"yKey":"xKey";this._seriesDictionary[series.get(seriesKey)]=series;}},_addSeries:function(series)
1568 {var type=series.get("type"),seriesCollection=this.get("seriesCollection"),graphSeriesLength=seriesCollection.length,seriesTypes=this.seriesTypes,typeSeriesCollection;if(!series.get("graph"))
1569 {series.set("graph",this);}
1570 seriesCollection.push(series);if(!seriesTypes.hasOwnProperty(type))
1571 {this.seriesTypes[type]=[];}
1572 typeSeriesCollection=this.seriesTypes[type];series.set("graphOrder",graphSeriesLength);series.set("order",typeSeriesCollection.length);typeSeriesCollection.push(series);this.addDispatcher(series);series.after("drawingComplete",Y.bind(this._drawingCompleteHandler,this));this.fire("seriesAdded",series);},_createSeries:function(seriesData)
1573 {var type=seriesData.type,seriesCollection=this.get("seriesCollection"),seriesTypes=this.seriesTypes,typeSeriesCollection,seriesType,series;seriesData.graph=this;if(!seriesTypes.hasOwnProperty(type))
1574 {seriesTypes[type]=[];}
1575 typeSeriesCollection=seriesTypes[type];seriesData.graph=this;seriesData.order=typeSeriesCollection.length;seriesData.graphOrder=seriesCollection.length;seriesType=this._getSeries(seriesData.type);series=new seriesType(seriesData);this.addDispatcher(series);series.after("drawingComplete",Y.bind(this._drawingCompleteHandler,this));typeSeriesCollection.push(series);seriesCollection.push(series);},_getSeries:function(type)
1576 {var seriesClass;switch(type)
1577 {case"line":seriesClass=Y.LineSeries;break;case"column":seriesClass=Y.ColumnSeries;break;case"bar":seriesClass=Y.BarSeries;break;case"area":seriesClass=Y.AreaSeries;break;case"candlestick":seriesClass=Y.CandlestickSeries;break;case"ohlc":seriesClass=Y.OHLCSeries;break;case"stackedarea":seriesClass=Y.StackedAreaSeries;break;case"stackedline":seriesClass=Y.StackedLineSeries;break;case"stackedcolumn":seriesClass=Y.StackedColumnSeries;break;case"stackedbar":seriesClass=Y.StackedBarSeries;break;case"markerseries":seriesClass=Y.MarkerSeries;break;case"spline":seriesClass=Y.SplineSeries;break;case"areaspline":seriesClass=Y.AreaSplineSeries;break;case"stackedspline":seriesClass=Y.StackedSplineSeries;break;case"stackedareaspline":seriesClass=Y.StackedAreaSplineSeries;break;case"stackedmarkerseries":seriesClass=Y.StackedMarkerSeries;break;case"pie":seriesClass=Y.PieSeries;break;case"combo":seriesClass=Y.ComboSeries;break;case"stackedcombo":seriesClass=Y.StackedComboSeries;break;case"combospline":seriesClass=Y.ComboSplineSeries;break;case"stackedcombospline":seriesClass=Y.StackedComboSplineSeries;break;default:seriesClass=Y.CartesianSeries;break;}
1578 return seriesClass;},_markerEventHandler:function(e)
1579 {var type=e.type,markerNode=e.currentTarget,strArr=markerNode.getAttribute("id").split("_"),series=this.getSeriesByIndex(strArr[1]),index=strArr[2];series.updateMarkerState(type,index);},_dispatchers:null,_updateStyles:function()
1580 {this._background.update(this.get("styles").background);this._sizeChangeHandler();},_sizeChangeHandler:function(e)
1581 {var hgl=this.get("horizontalGridlines"),vgl=this.get("verticalGridlines"),w=this.get("width"),h=this.get("height"),graphicNode,x=0,y=0,bg=this.get("styles").background,weight;if(bg&&bg.border)
1582 {weight=bg.border.weight||0;}
1583 if(this._background)
1584 {graphicNode=Y.one(this._background.parentNode);if(w&&h)
1585 {if(weight)
1586 {w+=weight*2;h+=weight*2;x-=weight;y-=weight;}
1587 graphicNode.setStyle("width",w);graphicNode.setStyle("height",h);graphicNode.setStyle("left",x);graphicNode.setStyle("top",y);this._background.update({width:w,height:h});}}
1588 if(hgl&&hgl instanceof Y.Gridlines)
1589 {hgl.draw();}
1590 if(vgl&&vgl instanceof Y.Gridlines)
1591 {vgl.draw();}
1592 this._drawSeries();},_drawSeries:function()
1593 {if(this._drawing)
1594 {this._callLater=true;return;}
1595 this._callLater=false;this._drawing=true;var sc=this.get("seriesCollection"),i=0,len=sc.length;for(;i<len;++i)
1596 {sc[i].draw();if(!sc[i].get("xcoords")||!sc[i].get("ycoords"))
1597 {this._callLater=true;break;}}
1598 this._drawing=false;if(this._callLater)
1599 {this._drawSeries();}},_drawingCompleteHandler:function(e)
1600 {var series=e.currentTarget,index=Y.Array.indexOf(this._dispatchers,series);if(index>-1)
1601 {this._dispatchers.splice(index,1);}
1602 if(this._dispatchers.length<1)
1603 {this.fire("chartRendered");}},_getDefaultStyles:function()
1604 {var defs={background:{shape:"rect",fill:{color:"#faf9f2"},border:{color:"#dad8c9",weight:1}}};return defs;}},{ATTRS:{seriesCollection:{getter:function()
1605 {return this._seriesCollection;},setter:function(val)
1606 {this._parseSeriesCollection(val);return this._seriesCollection;}},showBackground:{value:true},seriesDictionary:{readOnly:true,getter:function()
1607 {return this._seriesDictionary;}},horizontalGridlines:{value:null,setter:function(val)
1608 {var gl=this.get("horizontalGridlines");if(gl&&gl instanceof Y.Gridlines)
1609 {gl.remove();}
1610 if(val instanceof Y.Gridlines)
1611 {gl=val;val.set("graph",this);val.render();return val;}
1612 else if(val&&val.axis)
1613 {gl=new Y.Gridlines({direction:"horizontal",axis:val.axis,graph:this,styles:val.styles});gl.render();return gl;}}},verticalGridlines:{value:null,setter:function(val)
1614 {var gl=this.get("verticalGridlines");if(gl&&gl instanceof Y.Gridlines)
1615 {gl.remove();}
1616 if(val instanceof Y.Gridlines)
1617 {gl=val;val.set("graph",this);val.render();return val;}
1618 else if(val&&val.axis)
1619 {gl=new Y.Gridlines({direction:"vertical",axis:val.axis,graph:this,styles:val.styles});gl.render();return gl;}}}}});function ChartBase(){}
1620 ChartBase.ATTRS={tooltip:{valueFn:"_getTooltip",setter:function(val)
1621 {return this._updateTooltip(val);}},categoryKey:{value:"category"},categoryType:{value:"category"},interactionType:{value:"marker"},dataProvider:{setter:function(val)
1622 {return this._setDataValues(val);}},seriesKeys:{},axesCollection:{},graph:{valueFn:"_getGraph"}};ChartBase.prototype={_getGraph:function()
1623 {var graph=new Y.Graph();graph.after("chartRendered",Y.bind(function(e){this.fire("chartRendered");},this));return graph;},getSeries:function(val)
1624 {var series=null,graph=this.get("graph");if(graph)
1625 {if(Y.Lang.isNumber(val))
1626 {series=graph.getSeriesByIndex(val);}
1627 else
1628 {series=graph.getSeriesByKey(val);}}
1629 return series;},getAxisByKey:function(val)
1630 {var axis,axes=this.get("axes");if(axes.hasOwnProperty(val))
1631 {axis=axes[val];}
1632 return axis;},getCategoryAxis:function()
1633 {var axis,key=this.get("categoryKey"),axes=this.get("axes");if(axes.hasOwnProperty(key))
1634 {axis=axes[key];}
1635 return axis;},_direction:"horizontal",_dataProvider:null,_setDataValues:function(val)
1636 {if(Y.Lang.isArray(val[0]))
1637 {var hash,dp=[],cats=val[0],i=0,l=cats.length,n,sl=val.length;for(;i<l;++i)
1638 {hash={category:cats[i]};for(n=1;n<sl;++n)
1639 {hash["series"+n]=val[n][i];}
1640 dp[i]=hash;}
1641 return dp;}
1642 return val;},_seriesCollection:null,_setSeriesCollection:function(val)
1643 {this._seriesCollection=val;},_getAxisClass:function(t)
1644 {return this._axisClass[t];},_axisClass:{stacked:Y.StackedAxis,numeric:Y.NumericAxis,category:Y.CategoryAxis,time:Y.TimeAxis},_axes:null,renderUI:function()
1645 {var tt=this.get("tooltip");this.get("boundingBox").setStyle("position","absolute");this.get("contentBox").setStyle("position","absolute");this._addAxes();this._addSeries();if(tt&&tt.show)
1646 {this._addTooltip();}
1647 this._redraw();},bindUI:function()
1648 {this.after("tooltipChange",Y.bind(this._tooltipChangeHandler,this));this.after("widthChange",this._sizeChanged);this.after("heightChange",this._sizeChanged);this.after("dataProviderChange",this._dataProviderChangeHandler);var tt=this.get("tooltip"),hideEvent="mouseout",showEvent="mouseover",cb=this.get("contentBox"),interactionType=this.get("interactionType"),i=0,len;if(interactionType=="marker")
1649 {hideEvent=tt.hideEvent;showEvent=tt.showEvent;Y.delegate("mouseenter",Y.bind(this._markerEventDispatcher,this),cb,".yui3-seriesmarker");Y.delegate("mousedown",Y.bind(this._markerEventDispatcher,this),cb,".yui3-seriesmarker");Y.delegate("mouseup",Y.bind(this._markerEventDispatcher,this),cb,".yui3-seriesmarker");Y.delegate("mouseleave",Y.bind(this._markerEventDispatcher,this),cb,".yui3-seriesmarker");Y.delegate("click",Y.bind(this._markerEventDispatcher,this),cb,".yui3-seriesmarker");Y.delegate("mousemove",Y.bind(this._positionTooltip,this),cb,".yui3-seriesmarker");}
1650 else if(interactionType=="planar")
1651 {this._overlay.on("mousemove",Y.bind(this._planarEventDispatcher,this));this.on("mouseout",this.hideTooltip);}
1652 if(tt)
1653 {if(hideEvent&&showEvent&&hideEvent==showEvent)
1654 {this.on(interactionType+"Event:"+hideEvent,this.toggleTooltip);}
1655 else
1656 {if(showEvent)
1657 {this.on(interactionType+"Event:"+showEvent,tt[interactionType+"EventHandler"]);}
1658 if(hideEvent)
1659 {if(Y.Lang.isArray(hideEvent))
1660 {len=hideEvent.length;for(;i<len;++i)
1661 {this.on(interactionType+"Event:"+hideEvent[i],this.hideTooltip);}}
1662 this.on(interactionType+"Event:"+hideEvent,this.hideTooltip);}}}},_markerEventDispatcher:function(e)
1663 {var type=e.type,cb=this.get("contentBox"),markerNode=e.currentTarget,strArr=markerNode.getAttribute("id").split("_"),seriesIndex=strArr[1],series=this.getSeries(parseInt(seriesIndex,10)),index=strArr[2],items=this.getSeriesItems(series,index),x=e.pageX-cb.getX(),y=e.pageY-cb.getY();if(type=="mouseenter")
1664 {type="mouseover";}
1665 else if(type=="mouseleave")
1666 {type="mouseout";}
1667 series.updateMarkerState(type,index);e.halt();this.fire("markerEvent:"+type,{categoryItem:items.category,valueItem:items.value,node:markerNode,x:x,y:y,series:series,index:index,seriesIndex:seriesIndex});},_dataProviderChangeHandler:function(e)
1668 {var dataProvider=this.get("dataProvider"),axes=this.get("axes"),i,axis;for(i in axes)
1669 {if(axes.hasOwnProperty(i))
1670 {axis=axes[i];if(axis instanceof Y.Axis)
1671 {axis.set("dataProvider",dataProvider);}}}},toggleTooltip:function(e)
1672 {var tt=this.get("tooltip");if(tt.visible)
1673 {this.hideTooltip();}
1674 else
1675 {tt.markerEventHandler.apply(this,[e]);}},_showTooltip:function(msg,x,y)
1676 {var tt=this.get("tooltip"),node=tt.node;if(msg)
1677 {tt.visible=true;node.set("innerHTML",msg);node.setStyle("top",y+"px");node.setStyle("left",x+"px");node.removeClass("yui3-widget-hidden");}},_positionTooltip:function(e)
1678 {var tt=this.get("tooltip"),node=tt.node,cb=this.get("contentBox"),x=(e.pageX+10)-cb.getX(),y=(e.pageY+10)-cb.getY();if(node)
1679 {node.setStyle("left",x+"px");node.setStyle("top",y+"px");}},hideTooltip:function()
1680 {var tt=this.get("tooltip"),node=tt.node;tt.visible=false;node.set("innerHTML","");node.setStyle("left",-10000);node.setStyle("top",-10000);node.addClass("yui3-widget-hidden");},_addTooltip:function()
1681 {var tt=this.get("tooltip");this.get("contentBox").appendChild(tt.node);},_updateTooltip:function(val)
1682 {var tt=this._tooltip,i,styles=val.styles,props={markerLabelFunction:"markerLabelFunction",planarLabelFunction:"planarLabelFunction",showEvent:"showEvent",hideEvent:"hideEvent",markerEventHandler:"markerEventHandler",planarEventHandler:"planarEventHandler"};if(styles)
1683 {for(i in styles)
1684 {if(styles.hasOwnProperty(i))
1685 {tt.node.setStyle(i,styles[i]);}}}
1686 for(i in props)
1687 {if(val.hasOwnProperty(i))
1688 {tt[i]=val[i];}}
1689 return tt;},_getTooltip:function()
1690 {var node=document.createElement("div"),tt={markerLabelFunction:this._tooltipLabelFunction,planarLabelFunction:this._planarLabelFunction,show:true,hideEvent:"mouseout",showEvent:"mouseover",markerEventHandler:function(e)
1691 {var tt=this.get("tooltip"),msg=tt.markerLabelFunction.apply(this,[e.categoryItem,e.valueItem,e.index,e.series,e.seriesIndex]);this._showTooltip(msg,e.x+10,e.y+10);},planarEventHandler:function(e)
1692 {var tt=this.get("tooltip"),msg,categoryAxis=this.get("categoryAxis");msg=tt.planarLabelFunction.apply(this,[categoryAxis,e.valueItem,e.index,e.items,e.seriesIndex]);this._showTooltip(msg,e.x+10,e.y+10);}};node.setAttribute("id",this.get("id")+"_tooltip");node=Y.one(node);node.setStyle("fontSize","85%");node.setStyle("opacity","0.83");node.setStyle("position","absolute");node.setStyle("paddingTop","2px");node.setStyle("paddingRight","5px");node.setStyle("paddingBottom","4px");node.setStyle("paddingLeft","2px");node.setStyle("backgroundColor","#fff");node.setStyle("border","1px solid #dbdccc");node.setStyle("pointerEvents","none");node.setStyle("zIndex",3);node.setStyle("whiteSpace","noWrap");node.addClass("yui3-widget-hidden");tt.node=Y.one(node);this._tooltip=tt;return tt;},_planarLabelFunction:function(categoryAxis,valueItems,index,seriesArray,seriesIndex)
1693 {var msg="",valueItem,i=0,len=seriesArray.length,axis,series;if(categoryAxis)
1694 {msg+=categoryAxis.get("labelFunction").apply(this,[categoryAxis.getKeyValueAt(this.get("categoryKey"),index),categoryAxis.get("labelFormat")]);}
1695 for(;i<len;++i)
1696 {series=seriesArray[i];if(series.get("visible"))
1697 {valueItem=valueItems[i];axis=valueItem.axis;msg+="<br/><span>"+valueItem.displayName+": "+axis.get("labelFunction").apply(this,[axis.getKeyValueAt(valueItem.key,index),axis.get("labelFormat")])+"</span>";}}
1698 return msg;},_tooltipLabelFunction:function(categoryItem,valueItem,itemIndex,series,seriesIndex)
1699 {var msg=categoryItem.displayName+":&nbsp;"+categoryItem.axis.get("labelFunction").apply(this,[categoryItem.value,categoryItem.axis.get("labelFormat")])+"<br/>"+valueItem.displayName+":&nbsp;"+valueItem.axis.get("labelFunction").apply(this,[valueItem.value,valueItem.axis.get("labelFormat")]);return msg;},_tooltipChangeHandler:function(e)
1700 {if(this.get("tooltip"))
1701 {var tt=this.get("tooltip"),node=tt.node,show=tt.show,cb=this.get("contentBox");if(node&&show)
1702 {if(!cb.containes(node))
1703 {this._addTooltip();}}}}};Y.ChartBase=ChartBase;Y.CartesianChart=Y.Base.create("cartesianChart",Y.Widget,[Y.ChartBase],{renderUI:function()
1704 {var tt=this.get("tooltip"),overlay;this.get("boundingBox").setStyle("position","absolute");this.get("contentBox").setStyle("position","absolute");this._addAxes();this._addGridlines();this._addSeries();if(tt&&tt.show)
1705 {this._addTooltip();}
1706 this.get("styles");if(this.get("interactionType")=="planar")
1707 {overlay=document.createElement("div");this.get("contentBox").appendChild(overlay);this._overlay=Y.one(overlay);this._overlay.setStyle("position","absolute");this._overlay.setStyle("background","#fff");this._overlay.setStyle("opacity",0);this._overlay.addClass("yui3-overlay");this._overlay.setStyle("zIndex",4);}
1708 this._redraw();},_planarEventDispatcher:function(e)
1709 {var graph=this.get("graph"),bb=this.get("boundingBox"),cb=graph.get("contentBox"),x=e.pageX,offsetX=x-cb.getX(),posX=x-bb.getX(),y=e.pageY,offsetY=y-cb.getY(),posY=y-bb.getY(),sc=graph.get("seriesCollection"),series,i=0,index,oldIndex=this._selectedIndex,item,items=[],categoryItems=[],valueItems=[],direction=this.get("direction"),hasMarkers,coord=direction=="horizontal"?offsetX:offsetY,markerPlane=direction=="horizontal"?sc[0].get("xMarkerPlane"):sc[0].get("yMarkerPlane"),len=markerPlane.length;for(;i<len;++i)
1710 {if(coord<=markerPlane[i].end&&coord>=markerPlane[i].start)
1711 {index=i;break;}}
1712 len=sc.length;for(i=0;i<len;++i)
1713 {series=sc[i];hasMarkers=series.get("markers");if(hasMarkers&&!isNaN(oldIndex)&&oldIndex>-1)
1714 {series.updateMarkerState("mouseout",oldIndex);}
1715 if(series.get("ycoords")[index]>-1)
1716 {if(hasMarkers&&!isNaN(index)&&index>-1)
1717 {series.updateMarkerState("mouseover",index);}
1718 item=this.getSeriesItems(series,index);categoryItems.push(item.category);valueItems.push(item.value);items.push(series);}}
1719 this._selectedIndex=index;if(index>-1)
1720 {this.fire("planarEvent:mouseover",{categoryItem:categoryItems,valueItem:valueItems,x:posX,y:posY,items:items,index:index});}
1721 else
1722 {this.fire("planarEvent:mouseout");}},_type:"combo",_axesRenderQueue:null,_addToAxesRenderQueue:function(axis)
1723 {if(!this._axesRenderQueue)
1724 {this._axesRenderQueue=[];}
1725 if(Y.Array.indexOf(this._axesRenderQueue,axis)<0)
1726 {this._axesRenderQueue.push(axis);}},_getDefaultSeriesCollection:function(val)
1727 {var dir=this.get("direction"),sc=val||[],catAxis,valAxis,tempKeys=[],series,seriesKeys=this.get("seriesKeys").concat(),i,index,l,type=this.get("type"),key,catKey,seriesKey,graph,categoryKey=this.get("categoryKey"),showMarkers=this.get("showMarkers"),showAreaFill=this.get("showAreaFill"),showLines=this.get("showLines");if(dir=="vertical")
1728 {catAxis="yAxis";catKey="yKey";valAxis="xAxis";seriesKey="xKey";}
1729 else
1730 {catAxis="xAxis";catKey="xKey";valAxis="yAxis";seriesKey="yKey";}
1731 l=sc.length;for(i=0;i<l;++i)
1732 {key=this._getBaseAttribute(sc[i],seriesKey);if(key)
1733 {index=Y.Array.indexOf(seriesKeys,key);if(index>-1)
1734 {seriesKeys.splice(index,1);}
1735 tempKeys.push(key);}}
1736 if(seriesKeys.length>0)
1737 {tempKeys=tempKeys.concat(seriesKeys);}
1738 l=tempKeys.length;for(i=0;i<l;++i)
1739 {series=sc[i]||{type:type};if(series instanceof Y.CartesianSeries)
1740 {this._parseSeriesAxes(series);continue;}
1741 series[catKey]=series[catKey]||categoryKey;series[seriesKey]=series[seriesKey]||seriesKeys.shift();series[catAxis]=this._getCategoryAxis();series[valAxis]=this._getSeriesAxis(series[seriesKey]);series.type=series.type||type;if((series.type=="combo"||series.type=="stackedcombo"||series.type=="combospline"||series.type=="stackedcombospline"))
1742 {if(showAreaFill!==null)
1743 {series.showAreaFill=series.showAreaFill||showAreaFill;}
1744 if(showMarkers!==null)
1745 {series.showMarkers=series.showMarkers||showMarkers;}
1746 if(showLines!==null)
1747 {series.showLines=series.showLines||showLines;}}
1748 sc[i]=series;}
1749 if(val)
1750 {graph=this.get("graph");graph.set("seriesCollection",sc);sc=graph.get("seriesCollection");}
1751 return sc;},_parseSeriesAxes:function(series)
1752 {var axes=this.get("axes"),xAxis=series.get("xAxis"),yAxis=series.get("yAxis"),YAxis=Y.Axis,axis;if(xAxis&&!(xAxis instanceof YAxis)&&Y.Lang.isString(xAxis)&&axes.hasOwnProperty(xAxis))
1753 {axis=axes[xAxis];if(axis instanceof YAxis)
1754 {series.set("xAxis",axis);}}
1755 if(yAxis&&!(yAxis instanceof YAxis)&&Y.Lang.isString(yAxis)&&axes.hasOwnProperty(yAxis))
1756 {axis=axes[yAxis];if(axis instanceof YAxis)
1757 {series.set("yAxis",axis);}}},_getCategoryAxis:function()
1758 {var axis,axes=this.get("axes"),categoryAxisName=this.get("categoryAxisName")||this.get("categoryKey");axis=axes[categoryAxisName];return axis;},_getSeriesAxis:function(key,axisName)
1759 {var axes=this.get("axes"),i,keys,axis;if(axes)
1760 {if(axisName&&axes.hasOwnProperty(axisName))
1761 {axis=axes[axisName];}
1762 else
1763 {for(i in axes)
1764 {if(axes.hasOwnProperty(i))
1765 {keys=axes[i].get("keys");if(keys&&keys.hasOwnProperty(key))
1766 {axis=axes[i];break;}}}}}
1767 return axis;},_getBaseAttribute:function(item,key)
1768 {if(item instanceof Y.Base)
1769 {return item.get(key);}
1770 if(item.hasOwnProperty(key))
1771 {return item[key];}
1772 return null;},_setBaseAttribute:function(item,key,value)
1773 {if(item instanceof Y.Base)
1774 {item.set(key,value);}
1775 else
1776 {item[key]=value;}},_parseAxes:function(val)
1777 {var hash=this._getDefaultAxes(val),axes={},axesAttrs={edgeOffset:"edgeOffset",position:"position",overlapGraph:"overlapGraph",labelFunction:"labelFunction",labelFunctionScope:"labelFunctionScope",labelFormat:"labelFormat",maximum:"maximum",minimum:"minimum",roundingMethod:"roundingMethod",alwaysShowZero:"alwaysShowZero"},dp=this.get("dataProvider"),ai,i,pos,axis,dh,axisClass,config,axesCollection;for(i in hash)
1778 {if(hash.hasOwnProperty(i))
1779 {dh=hash[i];if(dh instanceof Y.Axis)
1780 {axis=dh;}
1781 else
1782 {axisClass=this._getAxisClass(dh.type);config={};config.dataProvider=dh.dataProvider||dp;config.keys=dh.keys;if(dh.hasOwnProperty("roundingUnit"))
1783 {config.roundingUnit=dh.roundingUnit;}
1784 pos=dh.position;if(dh.styles)
1785 {config.styles=dh.styles;}
1786 config.position=dh.position;for(ai in axesAttrs)
1787 {if(axesAttrs.hasOwnProperty(ai)&&dh.hasOwnProperty(ai))
1788 {config[ai]=dh[ai];}}
1789 axis=new axisClass(config);}
1790 if(axis)
1791 {axesCollection=this.get(pos+"AxesCollection");if(axesCollection&&Y.Array.indexOf(axesCollection,axis)>0)
1792 {axis.set("overlapGraph",false);}
1793 axis.after("axisRendered",Y.bind(this._axisRendered,this));axes[i]=axis;}}}
1794 return axes;},_addAxes:function()
1795 {var axes=this.get("axes"),i,axis,pos,w=this.get("width"),h=this.get("height"),node=Y.Node.one(this._parentNode);if(!this._axesCollection)
1796 {this._axesCollection=[];}
1797 for(i in axes)
1798 {if(axes.hasOwnProperty(i))
1799 {axis=axes[i];if(axis instanceof Y.Axis)
1800 {if(!w)
1801 {this.set("width",node.get("offsetWidth"));w=this.get("width");}
1802 if(!h)
1803 {this.set("height",node.get("offsetHeight"));h=this.get("height");}
1804 axis.set("width",w);axis.set("height",h);this._addToAxesRenderQueue(axis);pos=axis.get("position");if(!this.get(pos+"AxesCollection"))
1805 {this.set(pos+"AxesCollection",[axis]);}
1806 else
1807 {this.get(pos+"AxesCollection").push(axis);}
1808 this._axesCollection.push(axis);if(axis.get("keys").hasOwnProperty(this.get("categoryKey")))
1809 {this.set("categoryAxis",axis);}
1810 axis.render(this.get("contentBox"));}}}},_addSeries:function()
1811 {var graph=this.get("graph"),sc=this.get("seriesCollection");graph.render(this.get("contentBox"));},_addGridlines:function()
1812 {var graph=this.get("graph"),hgl=this.get("horizontalGridlines"),vgl=this.get("verticalGridlines"),direction=this.get("direction"),leftAxesCollection=this.get("leftAxesCollection"),rightAxesCollection=this.get("rightAxesCollection"),bottomAxesCollection=this.get("bottomAxesCollection"),topAxesCollection=this.get("topAxesCollection"),seriesAxesCollection,catAxis=this.get("categoryAxis"),hAxis,vAxis;if(this._axesCollection)
1813 {seriesAxesCollection=this._axesCollection.concat();seriesAxesCollection.splice(Y.Array.indexOf(seriesAxesCollection,catAxis),1);}
1814 if(hgl)
1815 {if(leftAxesCollection&&leftAxesCollection[0])
1816 {hAxis=leftAxesCollection[0];}
1817 else if(rightAxesCollection&&rightAxesCollection[0])
1818 {hAxis=rightAxesCollection[0];}
1819 else
1820 {hAxis=direction=="horizontal"?catAxis:seriesAxesCollection[0];}
1821 if(!this._getBaseAttribute(hgl,"axis")&&hAxis)
1822 {this._setBaseAttribute(hgl,"axis",hAxis);}
1823 if(this._getBaseAttribute(hgl,"axis"))
1824 {graph.set("horizontalGridlines",hgl);}}
1825 if(vgl)
1826 {if(bottomAxesCollection&&bottomAxesCollection[0])
1827 {vAxis=bottomAxesCollection[0];}
1828 else if(topAxesCollection&&topAxesCollection[0])
1829 {vAxis=topAxesCollection[0];}
1830 else
1831 {vAxis=direction=="vertical"?catAxis:seriesAxesCollection[0];}
1832 if(!this._getBaseAttribute(vgl,"axis")&&vAxis)
1833 {this._setBaseAttribute(vgl,"axis",vAxis);}
1834 if(this._getBaseAttribute(vgl,"axis"))
1835 {graph.set("verticalGridlines",vgl);}}},_getDefaultAxes:function(axes)
1836 {var catKey=this.get("categoryKey"),axis,attr,keys,newAxes={},claimedKeys=[],categoryAxisName=this.get("categoryAxisName")||this.get("categoryKey"),valueAxisName=this.get("valueAxisName"),seriesKeys=this.get("seriesKeys")||[],i,l,ii,ll,cIndex,dv,dp=this.get("dataProvider"),direction=this.get("direction"),seriesPosition,categoryPosition,valueAxes=[],seriesAxis=this.get("stacked")?"stacked":"numeric";dv=dp[0];if(direction=="vertical")
1837 {seriesPosition="bottom";categoryPosition="left";}
1838 else
1839 {seriesPosition="left";categoryPosition="bottom";}
1840 if(axes)
1841 {for(i in axes)
1842 {if(axes.hasOwnProperty(i))
1843 {axis=axes[i];keys=this._getBaseAttribute(axis,"keys");attr=this._getBaseAttribute(axis,"type");if(attr=="time"||attr=="category")
1844 {categoryAxisName=i;this.set("categoryAxisName",i);if(Y.Lang.isArray(keys)&&keys.length>0)
1845 {catKey=keys[0];this.set("categoryKey",catKey);}
1846 newAxes[i]=axis;}
1847 else if(i==categoryAxisName)
1848 {newAxes[i]=axis;}
1849 else
1850 {newAxes[i]=axis;if(i!=valueAxisName&&keys&&Y.Lang.isArray(keys))
1851 {ll=keys.length;for(ii=0;ii<ll;++ii)
1852 {claimedKeys.push(keys[ii]);}
1853 valueAxes.push(newAxes[i]);}
1854 if(!(this._getBaseAttribute(newAxes[i],"type")))
1855 {this._setBaseAttribute(newAxes[i],"type",seriesAxis);}
1856 if(!(this._getBaseAttribute(newAxes[i],"position")))
1857 {this._setBaseAttribute(newAxes[i],"position",this._getDefaultAxisPosition(newAxes[i],valueAxes,seriesPosition));}}}}}
1858 if(seriesKeys.length<1)
1859 {for(i in dv)
1860 {if(dv.hasOwnProperty(i)&&i!=catKey&&Y.Array.indexOf(claimedKeys,i)==-1)
1861 {seriesKeys.push(i);}}}
1862 cIndex=Y.Array.indexOf(seriesKeys,catKey);if(cIndex>-1)
1863 {seriesKeys.splice(cIndex,1);}
1864 l=claimedKeys.length;for(i=0;i<l;++i)
1865 {cIndex=Y.Array.indexOf(seriesKeys,claimedKeys[i]);if(cIndex>-1)
1866 {seriesKeys.splice(cIndex,1);}}
1867 if(!newAxes.hasOwnProperty(categoryAxisName))
1868 {newAxes[categoryAxisName]={};}
1869 if(!(this._getBaseAttribute(newAxes[categoryAxisName],"keys")))
1870 {this._setBaseAttribute(newAxes[categoryAxisName],"keys",[catKey]);}
1871 if(!(this._getBaseAttribute(newAxes[categoryAxisName],"position")))
1872 {this._setBaseAttribute(newAxes[categoryAxisName],"position",categoryPosition);}
1873 if(!(this._getBaseAttribute(newAxes[categoryAxisName],"type")))
1874 {this._setBaseAttribute(newAxes[categoryAxisName],"type",this.get("categoryType"));}
1875 if(!newAxes.hasOwnProperty(valueAxisName)&&seriesKeys&&seriesKeys.length>0)
1876 {newAxes[valueAxisName]={keys:seriesKeys};valueAxes.push(newAxes[valueAxisName]);}
1877 if(claimedKeys.length>0)
1878 {if(seriesKeys.length>0)
1879 {seriesKeys=claimedKeys.concat(seriesKeys);}
1880 else
1881 {seriesKeys=claimedKeys;}}
1882 if(newAxes.hasOwnProperty(valueAxisName))
1883 {if(!(this._getBaseAttribute(newAxes[valueAxisName],"position")))
1884 {this._setBaseAttribute(newAxes[valueAxisName],"position",this._getDefaultAxisPosition(newAxes[valueAxisName],valueAxes,seriesPosition));}
1885 if(!(this._getBaseAttribute(newAxes[valueAxisName],"type")))
1886 {this._setBaseAttribute(newAxes[valueAxisName],"type",seriesAxis);}
1887 if(!(this._getBaseAttribute(newAxes[valueAxisName],"keys")))
1888 {this._setBaseAttribute(newAxes[valueAxisName],"keys",seriesKeys);}}
1889 this.set("seriesKeys",seriesKeys);return newAxes;},_getDefaultAxisPosition:function(axis,valueAxes,position)
1890 {var direction=this.get("direction"),i=Y.Array.indexOf(valueAxes,axis);if(valueAxes[i-1]&&valueAxes[i-1].position)
1891 {if(direction=="horizontal")
1892 {if(valueAxes[i-1].position=="left")
1893 {position="right";}
1894 else if(valueAxes[i-1].position=="right")
1895 {position="left";}}
1896 else
1897 {if(valueAxes[i-1].position=="bottom")
1898 {position="top";}
1899 else
1900 {position="bottom";}}}
1901 return position;},getSeriesItems:function(series,index)
1902 {var xAxis=series.get("xAxis"),yAxis=series.get("yAxis"),xKey=series.get("xKey"),yKey=series.get("yKey"),categoryItem,valueItem;if(this.get("direction")=="vertical")
1903 {categoryItem={axis:yAxis,key:yKey,value:yAxis.getKeyValueAt(yKey,index)};valueItem={axis:xAxis,key:xKey,value:xAxis.getKeyValueAt(xKey,index)};}
1904 else
1905 {valueItem={axis:yAxis,key:yKey,value:yAxis.getKeyValueAt(yKey,index)};categoryItem={axis:xAxis,key:xKey,value:xAxis.getKeyValueAt(xKey,index)};}
1906 categoryItem.displayName=series.get("categoryDisplayName");valueItem.displayName=series.get("valueDisplayName");categoryItem.value=categoryItem.axis.getKeyValueAt(categoryItem.key,index);valueItem.value=valueItem.axis.getKeyValueAt(valueItem.key,index);return{category:categoryItem,value:valueItem};},_axisRendered:function(e)
1907 {this._axesRenderQueue=this._axesRenderQueue.splice(1+Y.Array.indexOf(this._axesRenderQueue,e.currentTarget),1);if(this._axesRenderQueue.length<1)
1908 {this._redraw();}},_sizeChanged:function(e)
1909 {if(this._axesCollection)
1910 {var ac=this._axesCollection,i=0,l=ac.length;for(;i<l;++i)
1911 {this._addToAxesRenderQueue(ac[i]);}
1912 this._redraw();}},_redraw:function()
1913 {if(this._drawing)
1914 {this._callLater=true;return;}
1915 this._drawing=true;this._callLater=false;var w=this.get("width"),h=this.get("height"),lw=0,rw=0,th=0,bh=0,lc=this.get("leftAxesCollection"),rc=this.get("rightAxesCollection"),tc=this.get("topAxesCollection"),bc=this.get("bottomAxesCollection"),i=0,l,axis,pos,pts=[],graphOverflow="visible",graph=this.get("graph");if(lc)
1916 {l=lc.length;for(i=l-1;i>-1;--i)
1917 {pts[Y.Array.indexOf(this._axesCollection,lc[i])]={x:lw+"px"};lw+=lc[i].get("width");}}
1918 if(rc)
1919 {l=rc.length;i=0;for(i=l-1;i>-1;--i)
1920 {rw+=rc[i].get("width");pts[Y.Array.indexOf(this._axesCollection,rc[i])]={x:(w-rw)+"px"};}}
1921 if(tc)
1922 {l=tc.length;for(i=l-1;i>-1;--i)
1923 {pts[Y.Array.indexOf(this._axesCollection,tc[i])]={y:th+"px"};th+=tc[i].get("height");}}
1924 if(bc)
1925 {l=bc.length;for(i=l-1;i>-1;--i)
1926 {bh+=bc[i].get("height");pts[Y.Array.indexOf(this._axesCollection,bc[i])]={y:(h-bh)+"px"};}}
1927 l=this._axesCollection.length;i=0;for(;i<l;++i)
1928 {axis=this._axesCollection[i];pos=axis.get("position");if(pos=="left"||pos==="right")
1929 {axis.get("boundingBox").setStyle("top",th+"px");axis.get("boundingBox").setStyle("left",pts[i].x);if(axis.get("height")!==h-(bh+th))
1930 {axis.set("height",h-(bh+th));}}
1931 else if(pos=="bottom"||pos=="top")
1932 {if(axis.get("width")!==w-(lw+rw))
1933 {axis.set("width",w-(lw+rw));}
1934 axis.get("boundingBox").setStyle("left",lw+"px");axis.get("boundingBox").setStyle("top",pts[i].y);}
1935 if(axis.get("setMax")||axis.get("setMin"))
1936 {graphOverflow="hidden";}}
1937 this._drawing=false;if(this._callLater)
1938 {this._redraw();return;}
1939 if(graph)
1940 {graph.get("boundingBox").setStyle("left",lw+"px");graph.get("boundingBox").setStyle("top",th+"px");graph.set("width",w-(lw+rw));graph.set("height",h-(th+bh));graph.get("boundingBox").setStyle("overflow",graphOverflow);}
1941 if(this._overlay)
1942 {this._overlay.setStyle("left",lw+"px");this._overlay.setStyle("top",th+"px");this._overlay.setStyle("width",(w-(lw+rw))+"px");this._overlay.setStyle("height",(h-(th+bh))+"px");}}},{ATTRS:{axesStyles:{getter:function()
1943 {var axes=this.get("axes"),i,styles=this._axesStyles;if(axes)
1944 {for(i in axes)
1945 {if(axes.hasOwnProperty(i)&&axes[i]instanceof Y.Axis)
1946 {if(!styles)
1947 {styles={};}
1948 styles[i]=axes[i].get("styles");}}}
1949 return styles;},setter:function(val)
1950 {var axes=this.get("axes"),i;for(i in val)
1951 {if(val.hasOwnProperty(i)&&axes.hasOwnProperty(i))
1952 {this._setBaseAttribute(axes[i],"styles",val[i]);}}}},seriesStyles:{getter:function()
1953 {var styles=this._seriesStyles,graph=this.get("graph"),dict,i;if(graph)
1954 {dict=graph.get("seriesDictionary");if(dict)
1955 {styles={};for(i in dict)
1956 {if(dict.hasOwnProperty(i))
1957 {styles[i]=dict[i].get("styles");}}}}
1958 return styles;},setter:function(val)
1959 {var i,l,s;if(Y.Lang.isArray(val))
1960 {s=this.get("seriesCollection");i=0;l=val.length;for(;i<l;++i)
1961 {this._setBaseAttribute(s[i],"styles",val[i]);}}
1962 else
1963 {for(i in val)
1964 {if(val.hasOwnProperty(i))
1965 {s=this.getSeries(i);this._setBaseAttribute(s,"styles",val[i]);}}}}},graphStyles:{getter:function()
1966 {var graph=this.get("graph");if(graph)
1967 {return(graph.get("styles"));}
1968 return this._graphStyles;},setter:function(val)
1969 {var graph=this.get("graph");this._setBaseAttribute(graph,"styles",val);}},styles:{getter:function()
1970 {var styles={axes:this.get("axesStyles"),series:this.get("seriesStyles"),graph:this.get("graphStyles")};return styles;},setter:function(val)
1971 {if(val.hasOwnProperty("axes"))
1972 {if(this.get("axesStyles"))
1973 {this.set("axesStyles",val.axes);}
1974 else
1975 {this._axesStyles=val.axes;}}
1976 if(val.hasOwnProperty("series"))
1977 {if(this.get("seriesStyles"))
1978 {this.set("seriesStyles",val.series);}
1979 else
1980 {this._seriesStyles=val.series;}}
1981 if(val.hasOwnProperty("graph"))
1982 {this.set("graphStyles",val.graph);}}},axes:{valueFn:"_parseAxes",setter:function(val)
1983 {return this._parseAxes(val);}},seriesCollection:{valueFn:"_getDefaultSeriesCollection",setter:function(val)
1984 {return this._getDefaultSeriesCollection(val);}},leftAxesCollection:{},bottomAxesCollection:{},rightAxesCollection:{},topAxesCollection:{},stacked:{value:false},direction:{getter:function()
1985 {var type=this.get("type");if(type=="bar")
1986 {return"vertical";}
1987 else if(type=="column")
1988 {return"horizontal";}
1989 return this._direction;},setter:function(val)
1990 {this._direction=val;return this._direction;}},showAreaFill:{},showMarkers:{},showLines:{},categoryAxisName:{},valueAxisName:{value:"values"},horizontalGridlines:{getter:function()
1991 {var graph=this.get("graph");if(graph)
1992 {return graph.get("horizontalGridlines");}
1993 return this._horizontalGridlines;},setter:function(val)
1994 {var graph=this.get("graph");if(val&&!Y.Lang.isObject(val))
1995 {val={};}
1996 if(graph)
1997 {graph.set("horizontalGridlines",val);}
1998 else
1999 {this._horizontalGridlines=val;}}},verticalGridlines:{getter:function()
2000 {var graph=this.get("graph");if(graph)
2001 {return graph.get("verticalGridlines");}
2002 return this._verticalGridlines;},setter:function(val)
2003 {var graph=this.get("graph");if(val&&!Y.Lang.isObject(val))
2004 {val={};}
2005 if(graph)
2006 {graph.set("verticalGridlines",val);}
2007 else
2008 {this._verticalGridlines=val;}}},type:{getter:function()
2009 {if(this.get("stacked"))
2010 {return"stacked"+this._type;}
2011 return this._type;},setter:function(val)
2012 {if(this._type=="bar")
2013 {if(val!="bar")
2014 {this.set("direction","horizontal");}}
2015 else
2016 {if(val=="bar")
2017 {this.set("direction","vertical");}}
2018 this._type=val;return this._type;}},categoryAxis:{}}});Y.PieChart=Y.Base.create("pieChart",Y.Widget,[Y.ChartBase],{_getSeriesCollection:function()
2019 {if(this._seriesCollection)
2020 {return this._seriesCollection;}
2021 var axes=this.get("axes"),sc=[],seriesKeys,i=0,l,type=this.get("type"),key,catAxis="categoryAxis",catKey="categoryKey",valAxis="valueAxis",seriesKey="valueKey";if(axes)
2022 {seriesKeys=axes.values.get("keyCollection");key=axes.category.get("keyCollection")[0];l=seriesKeys.length;for(;i<l;++i)
2023 {sc[i]={type:type};sc[i][catAxis]="category";sc[i][valAxis]="values";sc[i][catKey]=key;sc[i][seriesKey]=seriesKeys[i];}}
2024 this._seriesCollection=sc;return sc;},_parseAxes:function(hash)
2025 {if(!this._axes)
2026 {this._axes={};}
2027 var i,pos,axis,dh,config,axisClass,type=this.get("type"),w=this.get("width"),h=this.get("height"),node=Y.Node.one(this._parentNode);if(!w)
2028 {this.set("width",node.get("offsetWidth"));w=this.get("width");}
2029 if(!h)
2030 {this.set("height",node.get("offsetHeight"));h=this.get("height");}
2031 for(i in hash)
2032 {if(hash.hasOwnProperty(i))
2033 {dh=hash[i];pos=type=="pie"?"none":dh.position;axisClass=this._getAxisClass(dh.type);config={dataProvider:this.get("dataProvider")};if(dh.hasOwnProperty("roundingUnit"))
2034 {config.roundingUnit=dh.roundingUnit;}
2035 config.keys=dh.keys;config.width=w;config.height=h;config.position=pos;config.styles=dh.styles;axis=new axisClass(config);axis.on("axisRendered",Y.bind(this._axisRendered,this));this._axes[i]=axis;}}},_addAxes:function()
2036 {var axes=this.get("axes"),i,axis,p;if(!axes)
2037 {this.set("axes",this._getDefaultAxes());axes=this.get("axes");}
2038 if(!this._axesCollection)
2039 {this._axesCollection=[];}
2040 for(i in axes)
2041 {if(axes.hasOwnProperty(i))
2042 {axis=axes[i];p=axis.get("position");if(!this.get(p+"AxesCollection"))
2043 {this.set(p+"AxesCollection",[axis]);}
2044 else
2045 {this.get(p+"AxesCollection").push(axis);}
2046 this._axesCollection.push(axis);}}},_addSeries:function()
2047 {var graph=this.get("graph"),seriesCollection=this.get("seriesCollection");this._parseSeriesAxes(seriesCollection);graph.set("showBackground",false);graph.set("width",this.get("width"));graph.set("height",this.get("height"));graph.set("seriesCollection",seriesCollection);this._seriesCollection=graph.get("seriesCollection");graph.render(this.get("contentBox"));},_parseSeriesAxes:function(c)
2048 {var i=0,len=c.length,s,axes=this.get("axes"),axis;for(;i<len;++i)
2049 {s=c[i];if(s)
2050 {if(s instanceof Y.PieSeries)
2051 {axis=s.get("categoryAxis");if(axis&&!(axis instanceof Y.Axis))
2052 {s.set("categoryAxis",axes[axis]);}
2053 axis=s.get("valueAxis");if(axis&&!(axis instanceof Y.Axis))
2054 {s.set("valueAxis",axes[axis]);}
2055 continue;}
2056 s.categoryAxis=axes.category;s.valueAxis=axes.values;if(!s.type)
2057 {s.type=this.get("type");}}}},_getDefaultAxes:function()
2058 {var catKey=this.get("categoryKey"),seriesKeys=this.get("seriesKeys")||[],seriesAxis="numeric",i,dv=this.get("dataProvider")[0];if(seriesKeys.length<1)
2059 {for(i in dv)
2060 {if(i!=catKey)
2061 {seriesKeys.push(i);}}
2062 if(seriesKeys.length>0)
2063 {this.set("seriesKeys",seriesKeys);}}
2064 return{values:{keys:seriesKeys,type:seriesAxis},category:{keys:[catKey],type:this.get("categoryType")}};},getSeriesItems:function(series,index)
2065 {var categoryItem={axis:series.get("categoryAxis"),key:series.get("categoryKey"),displayName:series.get("categoryDisplayName")},valueItem={axis:series.get("valueAxis"),key:series.get("valueKey"),displayName:series.get("valueDisplayName")};categoryItem.value=categoryItem.axis.getKeyValueAt(categoryItem.key,index);valueItem.value=valueItem.axis.getKeyValueAt(valueItem.key,index);return{category:categoryItem,value:valueItem};},_sizeChanged:function(e)
2066 {this._redraw();},_redraw:function()
2067 {var graph=this.get("graph");if(graph)
2068 {graph.set("width",this.get("width"));graph.set("height",this.get("height"));}}},{ATTRS:{axes:{getter:function()
2069 {return this._axes;},setter:function(val)
2070 {this._parseAxes(val);}},seriesCollection:{getter:function()
2071 {return this._getSeriesCollection();},setter:function(val)
2072 {return this._setSeriesCollection(val);}},type:{value:"pie"}}});function Chart(cfg)
2073 {if(cfg.type!="pie")
2074 {return new Y.CartesianChart(cfg);}
2075 else
2076 {return new Y.PieChart(cfg);}}
2077 Y.Chart=Chart;},'3.3.0',{requires:['dom','datatype','event-custom','event-mouseenter','widget','widget-position','widget-stack']});