/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html version: 3.3.0 build: 3167 */ 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")) {DRAWINGAPI="svg";} else if(canvas&&canvas.getContext&&canvas.getContext("2d")) {DRAWINGAPI="canvas";} else {DRAWINGAPI="vml";} 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) {this.node=config.node;this._styleGroup(this.node);} else {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)) {this._gradientBox={tx:config.tx,ty:config.ty,width:config.width,height:config.height};} else {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;} return this;},beginGradientFill:function(config){var alphas=config.alphas||[];if(!this._defs) {this._defs=this._createGraphicNode("defs");this.node.appendChild(this._defs);} 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() {this._removeChildren(this.node);if(this.node&&this.node.parentNode) {this.node.parentNode.removeChild(this.node);}},_removeChildren:function(node) {if(node.hasChildNodes()) {var child;while(node.firstChild) {child=node.firstChild;this._removeChildren(child);node.removeChild(child);}}},toggleVisible:function(val) {this._toggleVisible(this.node,val);},_toggleVisible:function(node,val) {var children=Y.Selector.query(">/*",node),visibility=val?"visible":"hidden",i=0,len;if(children) {len=children.length;for(;i0) {this.node.removeChild(this._graphicsList.shift());}} this.path='';},curveTo:function(cp1x,cp1y,cp2x,cp2y,x,y){this._shapeType="path";if(this.path.indexOf("C")<0||this._pathType!=="C") {this._pathType="C";this.path+=' C';} 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") {this._pathType="Q";this.path+=" Q";} 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) {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) {this._draw();} 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;} 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]];} len=args.length;this._shapeType="path";if(this.path.indexOf("L")<0||this._pathType!=="L") {this._pathType="L";this.path+=' L';} for(i=0;i360) {arc=360;} segs=Math.ceil(Math.abs(arc)/ 45);segAngle=arc / segs;theta=-(segAngle / 180)*Math.PI;angle=(startAngle / 180)*Math.PI;if(segs>0) {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(;ithis.node.getAttribute("width")) {this.node.setAttribute("width",w);} if(h>this.node.getAttribute("height")) {this.node.setAttribute("height",h);}}},_trackSize:function(w,h){if(w>this._width){this._width=w;} if(h>this._height){this._height=h;} this.setSize(w,h);},setPosition:function(x,y) {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() {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() {var shape=this._createGraphicNode(this._shapeType),i,gradFill;if(this.path) {if(this._fill) {this.path+='z';} shape.setAttribute("d",this.path);} else {for(i in this._attributes) {if(this._attributes.hasOwnProperty(i)) {shape.setAttribute(i,this._attributes[i]);}}} shape.setAttribute("stroke-width",this._strokeWeight);if(this._strokeColor) {shape.setAttribute("stroke",this._strokeColor);shape.setAttribute("stroke-opacity",this._strokeAlpha);} if(!this._fillType||this._fillType==="solid") {if(this._fillColor) {shape.setAttribute("fill",this._fillColor);shape.setAttribute("fill-opacity",this._fillAlpha);} else {shape.setAttribute("fill","none");}} else if(this._fillType==="linear") {gradFill=this._getFill();gradFill.setAttribute("id",this._gradientId);this._defs.appendChild(gradFill);shape.setAttribute("fill","url(#"+this._gradientId+")");} 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;} 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) {if(r<180) {y1=0;y2=h;} else {y1=h;y2=0;} x1=cx-((cy-y1)/tanRadians);x2=cx-((cy-y2)/tanRadians);} else {if(r>90&&r<270) {x1=w;x2=0;} else {x1=0;x2=w;} y1=((tanRadians*(cx-x1))-cy)*-1;y2=((tanRadians*(cx-x2))-cy)*-1;} 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;i0) {w-=this._context.lineWidth*2;h-=this._context.lineWidth*2;x+=this._context.lineWidth;y+=this._context.lineWidth;} 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(;i360) {arc=360;} segs=Math.ceil(Math.abs(arc)/ 45);segAngle=arc / segs;theta=-(segAngle / 180)*Math.PI;angle=(startAngle / 180)*Math.PI;if(segs>0) {ax=x+Math.cos(startAngle / 180*Math.PI)*radius;ay=y+Math.sin(startAngle / 180*Math.PI)*yRadius;this.lineTo(ax,ay);for(;i=h/2) {if(r<180) {y1=y;y2=y+h;} else {y1=y+h;y2=y;} x1=cx-((cy-y1)/tanRadians);x2=cx-((cy-y2)/tanRadians);} else {if(r>90&&r<270) {x1=x+w;x2=x;} else {x1=x;x2=x+w;} y1=((tanRadians*(cx-x1))-cy)*-1;y2=((tanRadians*(cx-x2))-cy)*-1;} grad=ctx.createLinearGradient(x1,y1,x2,y2);l=colors.length;def=0;for(i=0;ithis._width){this._width=w;} if(h>this._height){this._height=h;}},_trackPos:function(x,y){if(x>this._x){this._x=x;} if(y>this._y){this._y=y;}},_updateShapeProps:function(x,y) {var w,h;if(!this._shape) {this._shape={};} if(!this._shape.x) {this._shape.x=x;} else {this._shape.x=Math.min(this._shape.x,x);} if(!this._shape.y) {this._shape.y=y;} else {this._shape.y=Math.min(this._shape.y,y);} w=Math.abs(x-this._shape.x);if(!this._shape.w) {this._shape.w=w;} else {this._shape.w=Math.max(w,this._shape.w);} h=Math.abs(y-this._shape.y);if(!this._shape.h) {this._shape.h=h;} else {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) {if(w>this.node.getAttribute("width")) {this.node.style.width=w+"px";this._canvas.style.width=w+"px";this._canvas.width=w;this.node.setAttribute("width",w);} if(h>this.node.getAttribute("height")) {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;} if(h>this._height){this._height=h;} this.setSize(w,h);},setPosition:function(x,y) {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) {this.node.style.visibility=val?"visible":"hidden";},_createGraphicNode:function(pe) {var node=Y.config.doc.createElement('canvas');node.style.pointerEvents=pe||"none";if(!this._graphicsList) {this._graphicsList=[];} this._graphicsList.push(node);return node;},destroy:function() {this._removeChildren(this.node);if(this.node&&this.node.parentNode) {this.node.parentNode.removeChild(this.node);}},_removeChildren:function(node) {if(node.hasChildNodes()) {var child;while(node.firstChild) {child=node.firstChild;this._removeChildren(child);node.removeChild(child);}}},node:null});if(DRAWINGAPI=="canvas") {Y.Graphic=Y.CanvasGraphic;} 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)) {this._gradientBox={tx:config.tx,ty:config.ty,width:config.width,height:config.height};} else {this._gradientBox=null;}},beginFill:function(color,alpha){if(color){if(Y.Lang.isNumber(alpha)){this._fillProps={type:"solid",opacity:alpha};} this._fillColor=color;this._fill=1;} 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(;i0?i+1:"";alphas[i]=Math.round(alpha*100)+"%";fill["opacity"+oi]=alpha;} if(type==="linear") {if(config) {} if(rotation>0&&rotation<=90) {rotation=450-rotation;} else if(rotation<=270) {rotation=270-rotation;} else if(rotation<=360) {rotation=630-rotation;} else {rotation=270;} fill.type="gradientunscaled";fill.angle=rotation;} else if(type==="radial") {fill.alignshape=false;fill.type="gradientradial";fill.focus="100%";fill.focusposition="50%,50%";} fill.ratios=ratios||[];if(!isNaN(config.tx)||!isNaN(config.ty)||!isNaN(config.width)||!isNaN(config.height)) {this._gradientBox={tx:config.tx,ty:config.ty,width:config.width,height:config.height};} else {this._gradientBox=null;} this._fillProps=fill;},clear:function(){this._path='';this._removeChildren(this.node);},destroy:function() {this._removeChildren(this.node);this.node.parentNode.removeChild(this.node);},_removeChildren:function(node) {if(node.hasChildNodes()) {var child;while(node.firstChild) {child=node.firstChild;this._removeChildren(child);node.removeChild(child);}}},toggleVisible:function(val) {this._toggleVisible(this.node,val);},_toggleVisible:function(node,val) {var children=Y.one(node).get("children"),visibility=val?"visible":"hidden",i=0,len;if(children) {len=children.length;for(;i360) {arc=360;} startAngle*=-65535;arc*=65536;path=" m "+x+" "+y+" ae "+x+" "+y+" "+radius+" "+yRadius+" "+startAngle+" "+arc;return path;},end:function(){if(this._shape) {this._draw();} 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]];} len=args.length;this._shape="shape";this._path+=' l ';for(i=0;ithis._width){this._width=w;} 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() {this._shape=null;this._path='';this._width=0;this._height=0;this._x=0;this._y=0;},_draw:function() {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) {if(this._fill||this._fillProps) {this._path+=' x';} if(this._stroke) {this._path+=' e';} shape.path=this._path;shape.coordSize=w+', '+h;} else {shape.style.display="block";shape.style.position="absolute";shape.style.left=this._x+"px";shape.style.top=this._y+"px";} if(this._fill){shape.fillColor=this._fillColor;} else {shape.filled=false;} if(this._stroke&&this._strokeWeight>0){shape.strokeColor=this._strokeColor;shape.strokeWeight=this._strokeWeight;if(Y.Lang.isNumber(this._strokeOpacity)&&this._strokeOpacity<1) {strokeNode=this._createGraphicNode("stroke");shape.appendChild(strokeNode);strokeNode.opacity=this._strokeOpacity;}}else{shape.stroked=false;} shape.style.width=w+'px';shape.style.height=h+'px';if(fillProps){shape.filled=true;shape.appendChild(this._getFill());} 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) {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;} if(fillProps.colors) {colors=fillProps.colors.concat();ratios=fillProps.ratios.concat();len=colors.length;for(;i');},_getNodeShapeType:function(type) {var shape="shape";if(this._typeConversionHash.hasOwnProperty(type)) {shape=this._typeConversionHash[type];} return shape;},_typeConversionHash:{circle:"oval",ellipse:"oval",rect:"rect"},getShape:function(config){config.graphic=this;return new Y.Shape(config);},addChild:function(child) {this.node.appendChild(child);}};if(DRAWINGAPI=="vml") {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;} function Shape(cfg) {this._initialize(cfg);this._draw();} Y.extend(Shape,Y.Graphic,{type:"shape",autoSize:false,pointerEvents:"visiblePainted",_initialize:function(cfg) {if(!cfg.graphic) {cfg.graphic=new Y.Graphic();} this._setProps(cfg);},_setProps:function(cfg) {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() {var cx,cy,rx,ry,parentNode=this.parentNode,borderWeight=0,fillWidth=this.width||0,fillHeight=this.height||0;if(!this.node) {this.node=this._createGraphicNode(this.nodetype,this.pointerEvents);parentNode.appendChild(this.node);} if(this.type=="wedge") {this.path=this._getWedgePath(this.props);} if(this.nodetype=="path") {this._setPath();} if(this.border&&this.border.weight&&this.border.weight>0) {borderWeight=this.border.weight;fillWidth-=borderWeight*2;fillHeight-=borderWeight*2;} this._addBorder();if(this.nodetype==="ellipse") {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);} else {this.node.setAttribute("width",fillWidth);this.node.setAttribute("height",fillHeight);this.node.style.width=fillWidth+"px";this.node.style.height=fillHeight+"px";} 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() {if(this.path) {this.path+=" Z";this.node.setAttribute("d",this.path);}},_addBorder:function() {if(this.border&&this.border.weight&&this.border.weight>0) {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);} else {this.node.setAttribute("stroke","none");}},_addFill:function() {var fillAlpha;if(this.fill.type==="linear"||this.fill.type==="radial") {this.beginGradientFill(this.fill);this.node.appendChild(this._getFill());} else if(this.fill.type==="bitmap") {this.beginBitmapFill(this.fill);this.node.appendChild(this._getFill());} else {if(!this.fill.color) {this.node.setAttribute("fill","none");} else {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() {this._setPath();},update:function(cfg) {this._setProps(cfg);this._draw();return this;},_getNodeShapeType:function(type) {if(this._typeConversionHash.hasOwnProperty(type)) {type=this._typeConversionHash[type];} return type;},toggleVisible:function(val) {var visibility=val?"visible":"hidden";if(this.node) {this.node.style.visibility=visibility;}},addClass:function(className) {var node=this.node;if(node) {if(node.className&&node.className.baseVal) {node.className.baseVal=Y.Lang.trim([node.className.baseVal,className].join(' '));} else {node.setAttribute("class",className);}}},setPosition:function(x,y) {var pNode=Y.one(this.parentNode),hotspot=this.hotspot;pNode.setStyle("position","absolute");pNode.setStyle("left",x);pNode.setStyle("top",y);if(hotspot) {hotspot.setStyle("position","absolute");hotspot.setStyle("left",x);hotspot.setStyle("top",y);}},_typeConversionHash:{circle:"ellipse",wedge:"path"}});Y.Shape=Shape;function CanvasShape(cfg) {this._dummy=this._createDummy();this._canvas=this._createGraphic();this.node=this._canvas;this._context=this._canvas.getContext('2d');this._initialize(cfg);this._validate();} Y.extend(CanvasShape,Y.CanvasDrawingUtil,{type:"shape",autoSize:false,_initialize:function(cfg) {this._canvas.style.position="absolute";if(cfg.graphic) {cfg.graphic.node.appendChild(this._canvas);} this._setProps(cfg);},_setProps:function(cfg) {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() {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) {border.color=border.color||"#000";border.alpha=border.alpha||1;this.lineStyle(border.weight,border.color,border.alpha);} if(fill.type==="radial"||fill.type==="linear") {this.beginGradientFill(fill);} else if(fill.type==="bitmap") {this.beginBitmapFill(fill);} else {this.beginFill(fill.color,fill.alpha);} switch(type) {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;} return this;},update:function(cfg) {this._setProps(cfg);this._validate();return this;},toggleVisible:function(val) {var visibility=val?"visible":"hidden";if(this.node) {this.node.style.visibility=visibility;}},setPosition:function(x,y) {var pNode=Y.one(this.parentNode);pNode.setStyle("position","absolute");pNode.setStyle("left",x);pNode.setStyle("top",y);},addClass:function(val) {if(this.node) {this.node.style.pointerEvents="painted";this.node.setAttribute("class",val);}}});Y.CanvasShape=CanvasShape;if(DRAWINGAPI=="canvas") {Y.Shape=Y.CanvasShape;} function VMLShape(cfg) {this._initialize(cfg);this._draw();} VMLShape.prototype={type:"shape",_initialize:function(cfg) {if(!cfg.graphic) {cfg.graphic=new Y.Graphic();} 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() {var path,borderWeight=0,fillWidth=this.width||0,fillHeight=this.height||0;this.graphics.setSize(fillWidth,fillHeight);if(this.node) {this.node.style.visible="hidden";} else if(!this.node) {this.node=this.graphics._createGraphicNode(this.graphics._getNodeShapeType(this.type));this.graphics.node.appendChild(this.node);} if(this.type==="wedge") {path=this.graphics._getWedgePath(this.props);if(this.fill) {path+=' x';} if(this.border) {path+=' e';} this.node.path=path;} this._addBorder();if(this.border&&this.border.weight&&this.border.weight>0) {borderWeight=this.border.weight;fillWidth-=borderWeight;fillHeight-=borderWeight;} this.node.style.width=Math.max(fillWidth,0)+"px";this.node.style.height=Math.max(fillHeight,0)+"px";this._addFill();return this;},_addBorder:function() {if(this.border&&this.border.weight&&this.border.weight>0) {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) {if(!this._strokeNode) {this._strokeNode=this.graphics._createGraphicNode("stroke");this.node.appendChild(this._strokeNode);} this._strokeNode.opacity=borderAlpha;} else if(this._strokeNode) {this._strokeNode.opacity=borderAlpha;} this.node.stroked=true;} else {this.node.stroked=false;}},_addFill:function() {var fillAlpha;this.node.filled=true;if(this.fill.type==="linear"||this.fill.type==="radial") {this.graphics.beginGradientFill(this.fill);this.node.appendChild(this.graphics._getFill());} else if(this.fill.type==="bitmap") {this.graphics.beginBitmapFill(this.fill);this.node.appendChild(this.graphics._getFill());} else {if(!this.fill.color) {this.node.filled=false;} else {if(this.fillnode) {this.graphics._removeChildren(this.fillnode);} 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) {var node=this.node;if(node) {Y.one(node).addClass(val);}},toggleVisible:function(val) {var visibility=val?"visible":"hidden";if(this.node) {Y.one(this.node).setStyle("visibility",visibility);}},setPosition:function(x,y) {var pNode=Y.one(this.parentNode);pNode.setStyle("position","absolute");pNode.setStyle("left",x);pNode.setStyle("top",y);},update:function(cfg) {this._setProps(cfg);this._draw();return this;}};Y.VMLShape=VMLShape;if(DRAWINGAPI=="vml"){Y.Shape=VMLShape;} function Renderer(){} Renderer.ATTRS={styles:{getter:function() {this._styles=this._styles||this._getDefaultStyles();return this._styles;},setter:function(val) {this._styles=this._setStyles(val);}},graphic:{}};Renderer.NAME="renderer";Renderer.prototype={_styles:null,_setStyles:function(newstyles) {var styles=this.get("styles");return this._mergeStyles(newstyles,styles);},_mergeStyles:function(a,b) {if(!b) {b={};} var newstyles=Y.merge(b,{});Y.Object.each(a,function(value,key,a) {if(b.hasOwnProperty(key)&&Y.Lang.isObject(value)&&!Y.Lang.isArray(value)) {newstyles[key]=this._mergeStyles(value,b[key]);} else {newstyles[key]=value;}},this);return newstyles;},_getDefaultStyles:function() {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) {if(this.get("rendered")) {this._drawAxis();}},_updateHandler:function(e) {if(this.get("rendered")) {this._drawAxis();}},_positionChangeHandler:function(e) {var position=this.get("position");if(position=="none") {return;} this._layout=this.getLayout(this.get("position"));if(this.get("rendered")) {this._drawAxis();}},renderUI:function() {var pos=this.get("position");if(pos&&pos!="none") {this._layout=this.getLayout(pos);this._setCanvas();}},syncUI:function() {this._drawAxis();},_setCanvas:function() {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") {cb.setStyle("width",w);} else {cb.setStyle("height",h);} 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() {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) {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")) {this._drawAxis();}},_layout:null,getLayout:function(pos) {var l;switch(pos) {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;} return l;},drawLine:function(startPoint,endPoint,line) {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() {if(this._drawing) {this._callLater=true;return;} this._drawing=true;this._callLater=false;if(this.get("position")!="none") {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) {layout.drawTick(tickPoint,majorTickStyles);} if(len<1) {this._clearLabelCache();return;} this._createLabelCache();this._tickPoints=[];layout.set("maxLabelSize",0);for(;i0) {label=cache.shift();} else {label=document.createElement("span");label.style.display="block";label.style.whiteSpace="nowrap";Y.one(label).addClass("axisLabel");this.get("contentBox").appendChild(label);} 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) {if(styles.hasOwnProperty(i)&&!customStyles.hasOwnProperty(i)) {label.style[i]=styles[i];}} return label;},_createLabelCache:function() {if(this._labels) {if(this._labelCache) {this._labelCache=this._labels.concat(this._labelCache);} else {this._labelCache=this._labels.concat();}} else {this._clearLabelCache();} this._labels=[];},_clearLabelCache:function() {if(this._labelCache) {var len=this._labelCache.length,i=0,label,labelCache=this._labelCache;for(;i0?-sinRadians:sinRadians,m21=-m12,m22=m11,max;if(!document.createElementNS) {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));} else {label.style.msTransform="rotate(0deg)";if(rot===0) {max=label.offsetWidth;} else if(absRot===90) {max=label.offsetHeight;} else {max=(cosRadians*label.offsetWidth)+(sinRadians*label.offsetHeight);} this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),max));}},positionLabel:function(label,pt) {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) {margin=style.margin.right;} if(!document.createElementNS) {label.style.filter=null;labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);if(rot===0) {leftOffset=labelWidth;topOffset-=labelHeight*0.5;} else if(absRot===90) {leftOffset=labelHeight;topOffset-=labelWidth*0.5;} else if(rot>0) {leftOffset=(cosRadians*labelWidth)+(labelHeight*rot/90);topOffset-=(sinRadians*labelWidth)+(cosRadians*(labelHeight*0.5));} else {leftOffset=(cosRadians*labelWidth)+(absRot/90*labelHeight);topOffset-=cosRadians*(labelHeight*0.5);} leftOffset+=tickOffset;label.style.left=((pt.x+maxLabelSize)-leftOffset)+"px";label.style.top=topOffset+"px";if(filterString) {filterString+=" ";} if(Y.Lang.isNumber(labelAlpha)&&labelAlpha<1&&labelAlpha>-1&&!isNaN(labelAlpha)) {filterString="progid:DXImageTransform.Microsoft.Alpha(Opacity="+Math.round(labelAlpha*100)+")";} if(rot!==0) {if(filterString) {filterString+=" ";} else {filterString="";} filterString+='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';} if(filterString) {label.style.filter=filterString;} return;} label.style.msTransform="rotate(0deg)";labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);if(rot===0) {leftOffset-=labelWidth;topOffset-=labelHeight*0.5;} else if(rot===90) {topOffset-=labelWidth*0.5;} else if(rot===-90) {leftOffset-=labelHeight;topOffset+=labelWidth*0.5;} else {if(rot<0) {leftOffset-=(cosRadians*labelWidth)+(sinRadians*labelHeight);topOffset+=(sinRadians*labelWidth)-(cosRadians*(labelHeight*0.6));} else {leftOffset-=(cosRadians*labelWidth);topOffset-=(sinRadians*labelWidth)+(cosRadians*(labelHeight*0.6));}} 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() {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) {sz+=margin.right;} 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) {},setCalculatedSize:function() {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) {RightAxisLayout.superclass.constructor.apply(this,arguments);} RightAxisLayout.ATTRS={axisRenderer:{value:null}};Y.extend(RightAxisLayout,Y.Base,{setTickOffsets:function() {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) {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) {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() {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") {pt.x+=tickLength;} else if(display==="cross") {pt.x+=tickLength/2;} return pt;},getLabelPoint:function(point) {var ar=this.get("axisRenderer");return{x:point.x+ar.get("rightTickOffset"),y:point.y};},updateMaxLabelSize:function(label) {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) {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));} else {label.style.msTransform="rotate(0deg)";if(rot===0) {max=label.offsetWidth;} else if(absRot===90) {max=label.offsetHeight;} else {max=(cosRadians*label.offsetWidth)+(sinRadians*label.offsetHeight);} this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),max));}},positionLabel:function(label,pt) {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) {margin=style.margin.right;} if(!document.createElementNS) {label.style.filter=null;if(rot===0) {topOffset-=labelHeight*0.5;} else if(absRot===90) {topOffset-=labelWidth*0.5;} else if(rot>0) {topOffset-=(cosRadians*(labelHeight*0.5));} else {topOffset-=(sinRadians*labelWidth)+(cosRadians*(labelHeight*0.5));} 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)) {filterString="progid:DXImageTransform.Microsoft.Alpha(Opacity="+Math.round(labelAlpha*100)+")";} if(rot!==0) {if(filterString) {filterString+=" ";} else {filterString="";} filterString+='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';} if(filterString) {label.style.filter=filterString;} return;} label.style.msTransform="rotate(0deg)";labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);if(rot===0) {topOffset-=labelHeight*0.5;} else if(rot===90) {leftOffset+=labelHeight;topOffset-=labelWidth*0.5;} else if(rot===-90) {topOffset+=labelWidth*0.5;} else if(rot<0) {topOffset-=(cosRadians*(labelHeight*0.6));} else {topOffset-=cosRadians*(labelHeight*0.6);leftOffset+=sinRadians*labelHeight;} 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() {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) {sz+=label.margin.weight;} ar.set("width",sz);ar.get("contentBox").setStyle("width",sz);},offsetNodeForTick:function(cb) {var ar=this.get("axisRenderer"),tickOffset=ar.get("leftTickOffset"),offset=0-tickOffset;cb.setStyle("left",offset);},setCalculatedSize:function() {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) {BottomAxisLayout.superclass.constructor.apply(this,arguments);} BottomAxisLayout.ATTRS={axisRenderer:{value:null},maxLabelSize:{value:0}};Y.extend(BottomAxisLayout,Y.Base,{setTickOffsets:function() {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) {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() {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") {pt.y+=tickLength;} else if(display==="cross") {pt.y+=tickLength/2;} return pt;},drawTick:function(pt,tickStyles) {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) {var ar=this.get("axisRenderer");return{x:point.x,y:point.y+ar.get("bottomTickOffset")};},updateMaxLabelSize:function(label) {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) {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));} else {label.style.msTransform="rotate(0deg)";if(rot===0) {max=label.offsetHeight;} else if(absRot===90) {max=label.offsetWidth;} else {max=(sinRadians*label.offsetWidth)+(cosRadians*label.offsetHeight);} this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),max));}},positionLabel:function(label,pt) {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) {margin=style.margin.top;} if(!document.createElementNS) {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) {leftOffset-=labelHeight*0.5;} else if(rot<0) {leftOffset-=cosRadians*labelWidth;leftOffset-=sinRadians*(labelHeight*0.5);} else if(rot>0) {leftOffset-=sinRadians*(labelHeight*0.5);} else {leftOffset-=labelWidth*0.5;} 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)) {filterString="progid:DXImageTransform.Microsoft.Alpha(Opacity="+Math.round(labelAlpha*100)+")";} if(rot!==0) {if(filterString) {filterString+=" ";} else {filterString="";} filterString+='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';} if(filterString) {label.style.filter=filterString;} return;} label.style.msTransform="rotate(0deg)";labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);if(rot===0) {leftOffset-=labelWidth*0.5;} else if(absRot===90) {if(rot===90) {leftOffset+=labelHeight*0.5;} else {topOffset+=labelWidth;leftOffset-=labelHeight*0.5;}} else {if(rot<0) {leftOffset-=(cosRadians*labelWidth)+(sinRadians*(labelHeight*0.6));topOffset+=sinRadians*labelWidth;} else {leftOffset+=Math.round(sinRadians*(labelHeight*0.6));}} 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() {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) {sz+=margin.top;} sz=Math.round(sz);ar.set("height",sz);},offsetNodeForTick:function(cb) {var ar=this.get("axisRenderer");ar.get("contentBox").setStyle("top",0-ar.get("topTickOffset"));},setCalculatedSize:function() {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) {TopAxisLayout.superclass.constructor.apply(this,arguments);} TopAxisLayout.ATTRS={axisRenderer:{value:null},maxLabelSize:{value:0}};Y.extend(TopAxisLayout,Y.Base,{setTickOffsets:function() {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) {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() {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") {pt.y+=tickLength;} else if(display==="cross") {pt.y+=tickLength/2;} return pt;},drawTick:function(pt,tickStyles) {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) {var ar=this.get("axisRenderer");return{x:pt.x,y:pt.y-ar.get("topTickOffset")};},updateMaxLabelSize:function(label) {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) {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));} else {label.style.msTransform="rotate(0deg)";if(rot===0) {max=label.offsetHeight;} else if(absRot===90) {max=label.offsetWidth;} else {max=(sinRadians*label.offsetWidth)+(cosRadians*label.offsetHeight);} this.set("maxLabelSize",Math.max(this.get("maxLabelSize"),max));}},positionLabel:function(label,pt) {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) {margin=style.margin.bottom;} if(!document.createElementNS) {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) {leftOffset-=labelWidth*0.5;} else if(absRot===90) {leftOffset-=labelHeight*0.5;} else if(rot>0) {leftOffset-=(cosRadians*labelWidth)+Math.min((sinRadians*labelHeight),(rot/180*labelHeight));topOffset-=(sinRadians*labelWidth)+(cosRadians*(labelHeight));topOffset+=maxLabelSize;} else {leftOffset-=sinRadians*(labelHeight*0.5);topOffset-=(sinRadians*labelWidth)+(cosRadians*(labelHeight));topOffset+=maxLabelSize;} topOffset-=tickOffset;label.style.left=leftOffset;label.style.top=topOffset;if(Y.Lang.isNumber(labelAlpha)&&labelAlpha<1&&labelAlpha>-1&&!isNaN(labelAlpha)) {filterString="progid:DXImageTransform.Microsoft.Alpha(Opacity="+Math.round(labelAlpha*100)+")";} if(rot!==0) {if(filterString) {filterString+=" ";} else {filterString="";} filterString+='progid:DXImageTransform.Microsoft.Matrix(M11='+m11+' M12='+m12+' M21='+m21+' M22='+m22+' sizingMethod="auto expand")';} if(filterString) {label.style.filter=filterString;} return;} label.style.msTransform="rotate(0deg)";labelWidth=Math.round(label.offsetWidth);labelHeight=Math.round(label.offsetHeight);if(rot===0) {leftOffset-=labelWidth*0.5;topOffset-=labelHeight;} else if(rot===90) {leftOffset+=labelHeight*0.5;topOffset-=labelWidth;} else if(rot===-90) {leftOffset-=labelHeight*0.5;topOffset-=0;} else if(rot<0) {leftOffset-=(sinRadians*(labelHeight*0.6));topOffset-=(cosRadians*labelHeight);} else {leftOffset-=(cosRadians*labelWidth)-(sinRadians*(labelHeight*0.6));topOffset-=(sinRadians*labelWidth)+(cosRadians*labelHeight);} 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() {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) {sz+=margin.bottom;} ar.set("height",sz);Y.one(graphic.node).setStyle("top",labelSize+margin.bottom);},offsetNodeForTick:function(cb) {},setCalculatedSize:function() {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() {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) {var keyCollection=this.get("keyCollection").concat(),keys=this.get("keys"),i;if(keys) {for(i in keys) {if(keys.hasOwnProperty(i)) {delete keys[i];}}} if(keyCollection&&keyCollection.length) {this.set("keys",keyCollection);}},GUID:"yuibaseaxis",_type:null,_setMaximum:null,_dataMaximum:null,_setMinimum:null,_data:null,_updateTotalDataFlag:true,_dataReady:false,addKey:function(value) {this.set("keys",value);},_getKeyArray:function(key,data) {var i=0,obj,keyArray=[],len=data.length;for(;i0) {len=data.length;max=min=data[0];if(len>1) {for(i=1;i=tempMajorUnit) {roundedDiff=Math.floor((roundedMajorUnit / 2-tempMajorUnit)/(Math.pow(10,order-1)/2));tempMajorUnit=roundedMajorUnit/2-roundedDiff*Math.pow(10,order-1)/2;} else {tempMajorUnit=roundedMajorUnit;} if(!isNaN(tempMajorUnit)) {return tempMajorUnit;} return roundingUnit;},_updateMinAndMax:function() {var data=this.get("data"),max=0,min=0,len,num,i,key,setMax=this.get("setMax"),setMin=this.get("setMin");if(!setMax&&!setMin) {if(data&&data.length&&data.length>0) {len=data.length;max=min=data[0];if(len>1) {for(i=1;i=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) {if(roundingMethod=="niceNumber") {roundingUnit=this._getMinimumUnit(max,min,units);if(minGreaterThanZero&&maxGreaterThanZero) {if(alwaysShowZero||min0) {max=0;roundingUnit=this._getMinimumUnit(max,min,units);} else {max=this._roundUpToNearest(max,roundingUnit);} min=max-(roundingUnit*units);}} else if(roundingMethod=="auto") {if(minGreaterThanZero&&maxGreaterThanZero) {if(alwaysShowZero||min<(max-min)/units) {min=0;} roundingUnit=(max-min)/units;if(useIntegers) {roundingUnit=Math.ceil(roundingUnit);} max=min+(roundingUnit*units);} else if(maxGreaterThanZero&&!minGreaterThanZero) {if(alwaysShowZero) {topTicks=Math.round(units /((-1*min)/max+1));botTicks=units-topTicks;if(useIntegers) {tempMax=Math.ceil(max/topTicks);tempMin=Math.floor(min/botTicks)*-1;} else {tempMax=max/topTicks;tempMin=min/botTicks*-1;} roundingUnit=Math.max(tempMax,tempMin);max=roundingUnit*topTicks;min=roundingUnit*botTicks*-1;} else {roundingUnit=(max-min)/units;if(useIntegers) {roundingUnit=Math.ceil(roundingUnit);} min=this._roundDownToNearest(min,roundingUnit);max=this._roundUpToNearest(max,roundingUnit);}} else {roundingUnit=(max-min)/units;if(useIntegers) {roundingUnit=Math.ceil(roundingUnit);} if(alwaysShowZero||max===0||max+roundingUnit>0) {max=0;roundingUnit=(max-min)/units;if(useIntegers) {Math.ceil(roundingUnit);}} else {max=this._roundUpToNearest(max,roundingUnit);} min=max-(roundingUnit*units);}} else if(!isNaN(roundingMethod)&&isFinite(roundingMethod)) {roundingUnit=roundingMethod;minimumRange=roundingUnit*units;dataRangeGreater=(max-min)>minimumRange;minRound=this._roundDownToNearest(min,roundingUnit);maxRound=this._roundUpToNearest(max,roundingUnit);if(minGreaterThanZero&&maxGreaterThanZero) {if(alwaysShowZero||minRound<=0) {min=0;} else {min=minRound;} if(!dataRangeGreater) {max=min+minimumRange;} else {max=maxRound;}} else if(maxGreaterThanZero&&!minGreaterThanZero) {min=minRound;if(!dataRangeGreater) {max=min+minimumRange;} else {max=maxRound;}} else {if(max===0||alwaysShowZero) {max=0;} else {max=maxRound;} if(!dataRangeGreater) {min=max-minimumRange;} else {min=minRound;}}}} this._dataMaximum=max;this._dataMinimum=min;},getLabelByIndex:function(i,l) {var min=this.get("minimum"),max=this.get("maximum"),increm=(max-min)/(l-1),label;l-=1;label=min+(i*increm);if(i>0) {label=this._roundToNearest(label,increm);} return label;},_roundToNearest:function(number,nearest) {nearest=nearest||1;if(nearest===0) {return number;} var roundedNumber=Math.round(this._roundToPrecision(number / nearest,10))*nearest;return this._roundToPrecision(roundedNumber,10);},_roundUpToNearest:function(number,nearest) {nearest=nearest||1;if(nearest===0) {return number;} return Math.ceil(this._roundToPrecision(number / nearest,10))*nearest;},_roundDownToNearest:function(number,nearest) {nearest=nearest||1;if(nearest===0) {return number;} return Math.floor(this._roundToPrecision(number / nearest,10))*nearest;},_roundToPrecision:function(number,precision) {precision=precision||0;var decimalPlaces=Math.pow(10,precision);return Math.round(decimalPlaces*number)/ decimalPlaces;}});Y.NumericAxis=NumericAxis;function StackedAxis(config) {StackedAxis.superclass.constructor.apply(this,arguments);} StackedAxis.NAME="stackedAxis";Y.extend(StackedAxis,Y.NumericAxis,{_updateMinAndMax:function() {var max=0,min=0,pos=0,neg=0,len=0,i=0,key,num,keys=this.get("keys");for(key in keys) {if(keys.hasOwnProperty(key)) {len=Math.max(len,keys[key].length);}} for(;i=0) {pos+=num;} else {neg+=num;}}} if(pos>0) {max=Math.max(max,pos);} else {max=Math.max(max,neg);} if(neg<0) {min=Math.min(min,neg);} else {min=Math.min(min,pos);}} this._roundMinAndMax(min,max);}});Y.StackedAxis=StackedAxis;function TimeAxis(config) {TimeAxis.superclass.constructor.apply(this,arguments);} TimeAxis.NAME="timeAxis";TimeAxis.ATTRS={setMax:{readOnly:true,getter:function() {var max=this._getNumber(this._setMaximum);return(Y.Lang.isNumber(max));}},setMin:{readOnly:true,getter:function() {var min=this._getNumber(this._setMinimum);return(Y.Lang.isNumber(min));}},maximum:{getter:function() {var max=this._getNumber(this._setMaximum);if(!Y.Lang.isNumber(max)) {max=this._getNumber(this.get("dataMaximum"));} return max;},setter:function(value) {this._setMaximum=this._getNumber(value);return value;}},minimum:{getter:function() {var min=this._getNumber(this._setMinimum);if(!Y.Lang.isNumber(min)) {min=this._getNumber(this.get("dataMinimum"));} return min;},setter:function(value) {this._setMinimum=this._getNumber(value);return value;}},labelFunction:{value:function(val,format) {val=Y.DataType.Date.parse(val);if(format) {return Y.DataType.Date.format(val,{format:format});} return val;}},labelFormat:{value:"%b %d, %y"}};Y.extend(TimeAxis,Y.AxisType,{GUID:"yuitimeaxis",_dataType:"time",getLabelByIndex:function(i,l) {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") {label=min+increm;} else {label=max-increm;} return label;},_getKeyArray:function(key,data) {var obj,keyArray=[],i=0,val,len=data.length;for(;idashSize) {graphic.lineTo(xCurrent+Math.cos(radians)*dashSize,yCurrent+Math.sin(radians)*dashSize);} else if(delta>0) {graphic.lineTo(xCurrent+Math.cos(radians)*delta,yCurrent+Math.sin(radians)*delta);} graphic.moveTo(xEnd,yEnd);},_getLineDefaults:function() {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) {var attrs={area:{getter:function() {return this._defaults||this._getAreaDefaults();},setter:function(val) {var defaults=this._defaults||this._getAreaDefaults();this._defaults=Y.merge(defaults,val);}}};this.addAttrs(attrs,cfg);this.get("styles");} Fills.prototype={drawFill:function(xcoords,ycoords) {if(xcoords.length<1) {return;} 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(;i0) {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(;i0) {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]);} else {if(direction==="vertical") {allXCoords.push(this._leftOrigin);allXCoords.push(this._leftOrigin);allYCoords.push(allYCoords[allYCoords.length-1]);allYCoords.push(firstY);} else {allXCoords.push(allXCoords[allXCoords.length-1]);allXCoords.push(firstX);allYCoords.push(this._bottomOrigin);allYCoords.push(this._bottomOrigin);}} return[allXCoords,allYCoords];},_getAreaDefaults:function() {return{};}};Y.augment(Fills,Y.Attribute);Y.Fills=Fills;function Plots(cfg) {var attrs={markers:{getter:function() {return this._markers;}}};this.addAttrs(attrs,cfg);} Plots.prototype={_plotDefaults:null,drawPlots:function() {if(!this.get("xcoords")||this.get("xcoords").length<1) {return;} 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)) {fillColors=style.fill.color.concat();} if(Y.Lang.isArray(style.border.color)) {borderColors=style.border.colors.concat();} this._createMarkerCache();if(isChrome) {this._createHotspotCache();} for(;i0) {while(!marker) {if(this._markerCache.length<1) {marker=this._createMarker(styles,order,index);break;} marker=this._markerCache.shift();} marker.update(styles);} else {marker=this._createMarker(styles,order,index);} this._markers.push(marker);this._graphicNodes.push(marker.parentNode);return marker;},_createMarker:function(styles,order,index) {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() {if(this._markers&&this._markers.length>0) {this._markerCache=this._markers.concat();} else {this._markerCache=[];} this._markers=[];this._graphicNodes=[];},_clearMarkerCache:function() {var len=this._markerCache.length,i=0,graphic,marker;for(;i0) {while(!hotspot) {if(this._hotspotCache.length<1) {hotspot=this._createHotspot(styles,order,index);break;} hotspot=this._hotspotCache.shift();} hotspot.update(styles);} else {hotspot=this._createHotspot(styles,order,index);} this._hotspots.push(hotspot);return hotspot;},_createHotspot:function(styles,order,index) {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() {if(this._hotspots&&this._hotspots.length>0) {this._hotspotCache=this._hotspots.concat();} else {this._hotspotCache=[];} this._hotspots=[];},_clearHotspotCache:function() {var len=this._hotspotCache.length,i=0,graphic,hotspot;for(;ii) {offset=seriesSize;}} totalSize=len*seriesSize;if(totalSize>graph.get(setSizeKey)) {ratio=graph.get(setSizeKey)/totalSize;seriesSize*=ratio;offset*=ratio;setSize*=ratio;setSize=Math.max(setSize,1);} offset-=seriesSize/2;for(i=0;i0&&h>0)&&((this.get("xData")&&this.get("yData"))||this._updateAxisData())) {if(this._drawing) {this._callLater=true;return;} this._drawing=true;this._callLater=false;this.setAreaData();if(this.get("xcoords")&&this.get("ycoords")) {this.drawSeries();} this._drawing=false;if(this._callLater) {this.draw();} else {this._toggleVisible(this.get("visible"));this.fire("drawingComplete");}}}},_defaultPlaneOffset:4,_getDefaultStyles:function() {return{padding:{top:0,left:0,right:0,bottom:0}};},_defaultLineColors:["#426ab3","#d09b2c","#000000","#b82837","#b384b5","#ff7200","#779de3","#cbc8ba","#7ed7a6","#007a6c"],_defaultFillColors:["#6084d0","#eeb647","#6c6b5f","#d6484f","#ce9ed1","#ff9f3b","#93b7ff","#e0ddd0","#94ecba","#309687"],_defaultBorderColors:["#205096","#b38206","#000000","#94001e","#9d6fa0","#e55b00","#5e85c9","#adab9e","#6ac291","#006457"],_defaultSliceColors:["#66007f","#a86f41","#295454","#996ab2","#e8cdb7","#90bdbd","#000000","#c3b8ca","#968373","#678585"],_getDefaultColor:function(index,type) {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) {index=index%l;} type=type||"fill";return colors[type][index];},_toggleVisible:function(e) {var graphic=this.get("graphic"),markers=this.get("markers"),i=0,len,visible=this.get("visible"),marker;if(graphic) {graphic.toggleVisible(visible);} if(markers) {len=markers.length;for(;in) {offset=seriesSize;} offset-=seriesSize/2;} for(n=0;nn) {offset=seriesSize;} offset-=seriesSize/2;} for(n=0;nthis.get("width")) {ratio=this.width/totalWidth;w*=ratio;w=Math.max(w,1);} if(!useOrigin) {lastCollection=seriesCollection[order-1];negativeBaseValues=lastCollection.get("negativeBaseValues");positiveBaseValues=lastCollection.get("positiveBaseValues");} else {negativeBaseValues=[];positiveBaseValues=[];} this.set("negativeBaseValues",negativeBaseValues);this.set("positiveBaseValues",positiveBaseValues);for(i=0;ithis._bottomOrigin) {positiveBaseValues[i]=this._bottomOrigin;negativeBaseValues[i]=top;} else {positiveBaseValues[i]=top;negativeBaseValues[i]=top;}} else {if(top>this._bottomOrigin) {top+=(negativeBaseValues[i]-this._bottomOrigin);h=negativeBaseValues[i]-top;negativeBaseValues[i]=top;} else if(topthis.get("height")) {ratio=this.height/totalHeight;h*=ratio;h=Math.max(h,1);} if(!useOrigin) {lastCollection=seriesCollection[order-1];negativeBaseValues=lastCollection.get("negativeBaseValues");positiveBaseValues=lastCollection.get("positiveBaseValues");} else {negativeBaseValues=[];positiveBaseValues=[];} this.set("negativeBaseValues",negativeBaseValues);this.set("positiveBaseValues",positiveBaseValues);for(i=0;ithis._leftOrigin) {positiveBaseValues[i]=left;negativeBaseValues[i]=this._leftOrigin;} else if(leftthis._leftOrigin) {left+=(positiveBaseValues[i]-this._leftOrigin);w=left-positiveBaseValues[i];positiveBaseValues[i]=left;left-=w;}} top-=h/2;style.width=w;style.height=h;marker=this.getMarker(style,graphOrder,i);marker.setPosition(left,top);if(isChrome) {hotspot=this.getHotspot(style,graphOrder,i);hotspot.setPosition(left,top);hotspot.parentNode.style.zIndex=5;}} this._clearMarkerCache();if(isChrome) {this._clearHotspotCache();}},updateMarkerState:function(type,i) {if(this._markers[i]) {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) {Y.one(marker.parentNode).setStyle("top",(ycoords[i]-h/2));}}},_getPlotDefaults:function() {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() {var id="pieHotSpotMapi_"+Math.round(100000*Math.random()),cb=this.get("graph").get("contentBox"),areaNode;if(this._image) {cb.removeChild(this._image);while(this._areaNodes&&this._areaNodes.length>0) {areaNode=this._areaNodes.shift();this._map.removeChild(areaNode);} cb.removeChild(this._map);} 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() {var categoryAxis=this.get("categoryAxis"),valueAxis=this.get("valueAxis");if(categoryAxis) {categoryAxis.after("dataReady",Y.bind(this._categoryDataChangeHandler,this));categoryAxis.after("dataUpdate",Y.bind(this._categoryDataChangeHandler,this));} if(valueAxis) {valueAxis.after("dataReady",Y.bind(this._valueDataChangeHandler,this));valueAxis.after("dataUpdate",Y.bind(this._valueDataChangeHandler,this));} this.after("categoryAxisChange",this.categoryAxisChangeHandler);this.after("valueAxisChange",this.valueAxisChangeHandler);this.after("stylesChange",this._updateHandler);},validate:function() {this.draw();this._renderered=true;},_categoryAxisChangeHandler:function(e) {var categoryAxis=this.get("categoryAxis");categoryAxis.after("dataReady",Y.bind(this._categoryDataChangeHandler,this));categoryAxis.after("dataUpdate",Y.bind(this._categoryDataChangeHandler,this));},_valueAxisChangeHandler:function(e) {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) {if(this._rendered&&this.get("categoryKey")&&this.get("valueKey")) {this.draw();}},_valueDataChangeHandler:function(event) {if(this._rendered&&this.get("categoryKey")&&this.get("valueKey")) {this.draw();}},draw:function() {var graph=this.get("graph"),w=graph.get("width"),h=graph.get("height");if(isFinite(w)&&isFinite(h)&&w>0&&h>0) {this._rendered=true;this.drawSeries();this.fire("drawingComplete");}},drawPlots:function() {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=l) {index=index%l;} type=type||"fill";return colors[type][index];}},{ATTRS:{type:{value:"pie"},order:{},graph:{},categoryAxis:{value:null,validator:function(value) {return value!==this.get("categoryAxis");}},valueAxis:{value:null,validator:function(value) {return value!==this.get("valueAxis");}},categoryKey:{value:null,validator:function(value) {return value!==this.get("categoryKey");}},valueKey:{value:null,validator:function(value) {return value!==this.get("valueKey");}},categoryDisplayName:{setter:function(val) {this._categoryDisplayName=val;return val;},getter:function() {return this._categoryDisplayName||this.get("categoryKey");}},valueDisplayName:{setter:function(val) {this._valueDisplayName=val;return val;},getter:function() {return this._valueDisplayName||this.get("valueKey");}},slices:null}});Y.Gridlines=Y.Base.create("gridlines",Y.Base,[Y.Renderer],{render:function() {this._setCanvas();},remove:function() {var graphic=this.get("graphic"),gNode;if(graphic) {gNode=graphic.node;if(gNode) {Y.one(gNode).remove();}}},draw:function() {if(this.get("axis")&&this.get("graph")) {this._drawGridlines();}},_drawGridlines:function() {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") {points=[];l=axis.get("styles").majorUnit.count;for(;ival) {series=col[val];} return series;},getSeriesByKey:function(val) {var obj=this._seriesDictionary,series;if(obj&&obj.hasOwnProperty(val)) {series=obj[val];} return series;},addDispatcher:function(val) {if(!this._dispatchers) {this._dispatchers=[];} this._dispatchers.push(val);},_seriesCollection:null,_seriesDictionary:null,_parseSeriesCollection:function(val) {if(!val) {return;} var len=val.length,i=0,series,seriesKey;if(!this.get("seriesCollection")) {this._seriesCollection=[];} if(!this._seriesDictionary) {this._seriesDictionary={};} if(!this.seriesTypes) {this.seriesTypes=[];} for(;i-1) {this._dispatchers.splice(index,1);} if(this._dispatchers.length<1) {this.fire("chartRendered");}},_getDefaultStyles:function() {var defs={background:{shape:"rect",fill:{color:"#faf9f2"},border:{color:"#dad8c9",weight:1}}};return defs;}},{ATTRS:{seriesCollection:{getter:function() {return this._seriesCollection;},setter:function(val) {this._parseSeriesCollection(val);return this._seriesCollection;}},showBackground:{value:true},seriesDictionary:{readOnly:true,getter:function() {return this._seriesDictionary;}},horizontalGridlines:{value:null,setter:function(val) {var gl=this.get("horizontalGridlines");if(gl&&gl instanceof Y.Gridlines) {gl.remove();} if(val instanceof Y.Gridlines) {gl=val;val.set("graph",this);val.render();return val;} else if(val&&val.axis) {gl=new Y.Gridlines({direction:"horizontal",axis:val.axis,graph:this,styles:val.styles});gl.render();return gl;}}},verticalGridlines:{value:null,setter:function(val) {var gl=this.get("verticalGridlines");if(gl&&gl instanceof Y.Gridlines) {gl.remove();} if(val instanceof Y.Gridlines) {gl=val;val.set("graph",this);val.render();return val;} else if(val&&val.axis) {gl=new Y.Gridlines({direction:"vertical",axis:val.axis,graph:this,styles:val.styles});gl.render();return gl;}}}}});function ChartBase(){} ChartBase.ATTRS={tooltip:{valueFn:"_getTooltip",setter:function(val) {return this._updateTooltip(val);}},categoryKey:{value:"category"},categoryType:{value:"category"},interactionType:{value:"marker"},dataProvider:{setter:function(val) {return this._setDataValues(val);}},seriesKeys:{},axesCollection:{},graph:{valueFn:"_getGraph"}};ChartBase.prototype={_getGraph:function() {var graph=new Y.Graph();graph.after("chartRendered",Y.bind(function(e){this.fire("chartRendered");},this));return graph;},getSeries:function(val) {var series=null,graph=this.get("graph");if(graph) {if(Y.Lang.isNumber(val)) {series=graph.getSeriesByIndex(val);} else {series=graph.getSeriesByKey(val);}} return series;},getAxisByKey:function(val) {var axis,axes=this.get("axes");if(axes.hasOwnProperty(val)) {axis=axes[val];} return axis;},getCategoryAxis:function() {var axis,key=this.get("categoryKey"),axes=this.get("axes");if(axes.hasOwnProperty(key)) {axis=axes[key];} return axis;},_direction:"horizontal",_dataProvider:null,_setDataValues:function(val) {if(Y.Lang.isArray(val[0])) {var hash,dp=[],cats=val[0],i=0,l=cats.length,n,sl=val.length;for(;i"+valueItem.displayName+": "+axis.get("labelFunction").apply(this,[axis.getKeyValueAt(valueItem.key,index),axis.get("labelFormat")])+"";}} return msg;},_tooltipLabelFunction:function(categoryItem,valueItem,itemIndex,series,seriesIndex) {var msg=categoryItem.displayName+": "+categoryItem.axis.get("labelFunction").apply(this,[categoryItem.value,categoryItem.axis.get("labelFormat")])+"
"+valueItem.displayName+": "+valueItem.axis.get("labelFunction").apply(this,[valueItem.value,valueItem.axis.get("labelFormat")]);return msg;},_tooltipChangeHandler:function(e) {if(this.get("tooltip")) {var tt=this.get("tooltip"),node=tt.node,show=tt.show,cb=this.get("contentBox");if(node&&show) {if(!cb.containes(node)) {this._addTooltip();}}}}};Y.ChartBase=ChartBase;Y.CartesianChart=Y.Base.create("cartesianChart",Y.Widget,[Y.ChartBase],{renderUI:function() {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) {this._addTooltip();} this.get("styles");if(this.get("interactionType")=="planar") {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);} this._redraw();},_planarEventDispatcher:function(e) {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=markerPlane[i].start) {index=i;break;}} len=sc.length;for(i=0;i-1) {series.updateMarkerState("mouseout",oldIndex);} if(series.get("ycoords")[index]>-1) {if(hasMarkers&&!isNaN(index)&&index>-1) {series.updateMarkerState("mouseover",index);} item=this.getSeriesItems(series,index);categoryItems.push(item.category);valueItems.push(item.value);items.push(series);}} this._selectedIndex=index;if(index>-1) {this.fire("planarEvent:mouseover",{categoryItem:categoryItems,valueItem:valueItems,x:posX,y:posY,items:items,index:index});} else {this.fire("planarEvent:mouseout");}},_type:"combo",_axesRenderQueue:null,_addToAxesRenderQueue:function(axis) {if(!this._axesRenderQueue) {this._axesRenderQueue=[];} if(Y.Array.indexOf(this._axesRenderQueue,axis)<0) {this._axesRenderQueue.push(axis);}},_getDefaultSeriesCollection:function(val) {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") {catAxis="yAxis";catKey="yKey";valAxis="xAxis";seriesKey="xKey";} else {catAxis="xAxis";catKey="xKey";valAxis="yAxis";seriesKey="yKey";} l=sc.length;for(i=0;i-1) {seriesKeys.splice(index,1);} tempKeys.push(key);}} if(seriesKeys.length>0) {tempKeys=tempKeys.concat(seriesKeys);} l=tempKeys.length;for(i=0;i0) {axis.set("overlapGraph",false);} axis.after("axisRendered",Y.bind(this._axisRendered,this));axes[i]=axis;}}} return axes;},_addAxes:function() {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) {this._axesCollection=[];} for(i in axes) {if(axes.hasOwnProperty(i)) {axis=axes[i];if(axis instanceof Y.Axis) {if(!w) {this.set("width",node.get("offsetWidth"));w=this.get("width");} if(!h) {this.set("height",node.get("offsetHeight"));h=this.get("height");} axis.set("width",w);axis.set("height",h);this._addToAxesRenderQueue(axis);pos=axis.get("position");if(!this.get(pos+"AxesCollection")) {this.set(pos+"AxesCollection",[axis]);} else {this.get(pos+"AxesCollection").push(axis);} this._axesCollection.push(axis);if(axis.get("keys").hasOwnProperty(this.get("categoryKey"))) {this.set("categoryAxis",axis);} axis.render(this.get("contentBox"));}}}},_addSeries:function() {var graph=this.get("graph"),sc=this.get("seriesCollection");graph.render(this.get("contentBox"));},_addGridlines:function() {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) {seriesAxesCollection=this._axesCollection.concat();seriesAxesCollection.splice(Y.Array.indexOf(seriesAxesCollection,catAxis),1);} if(hgl) {if(leftAxesCollection&&leftAxesCollection[0]) {hAxis=leftAxesCollection[0];} else if(rightAxesCollection&&rightAxesCollection[0]) {hAxis=rightAxesCollection[0];} else {hAxis=direction=="horizontal"?catAxis:seriesAxesCollection[0];} if(!this._getBaseAttribute(hgl,"axis")&&hAxis) {this._setBaseAttribute(hgl,"axis",hAxis);} if(this._getBaseAttribute(hgl,"axis")) {graph.set("horizontalGridlines",hgl);}} if(vgl) {if(bottomAxesCollection&&bottomAxesCollection[0]) {vAxis=bottomAxesCollection[0];} else if(topAxesCollection&&topAxesCollection[0]) {vAxis=topAxesCollection[0];} else {vAxis=direction=="vertical"?catAxis:seriesAxesCollection[0];} if(!this._getBaseAttribute(vgl,"axis")&&vAxis) {this._setBaseAttribute(vgl,"axis",vAxis);} if(this._getBaseAttribute(vgl,"axis")) {graph.set("verticalGridlines",vgl);}}},_getDefaultAxes:function(axes) {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") {seriesPosition="bottom";categoryPosition="left";} else {seriesPosition="left";categoryPosition="bottom";} if(axes) {for(i in axes) {if(axes.hasOwnProperty(i)) {axis=axes[i];keys=this._getBaseAttribute(axis,"keys");attr=this._getBaseAttribute(axis,"type");if(attr=="time"||attr=="category") {categoryAxisName=i;this.set("categoryAxisName",i);if(Y.Lang.isArray(keys)&&keys.length>0) {catKey=keys[0];this.set("categoryKey",catKey);} newAxes[i]=axis;} else if(i==categoryAxisName) {newAxes[i]=axis;} else {newAxes[i]=axis;if(i!=valueAxisName&&keys&&Y.Lang.isArray(keys)) {ll=keys.length;for(ii=0;ii-1) {seriesKeys.splice(cIndex,1);} l=claimedKeys.length;for(i=0;i-1) {seriesKeys.splice(cIndex,1);}} if(!newAxes.hasOwnProperty(categoryAxisName)) {newAxes[categoryAxisName]={};} if(!(this._getBaseAttribute(newAxes[categoryAxisName],"keys"))) {this._setBaseAttribute(newAxes[categoryAxisName],"keys",[catKey]);} if(!(this._getBaseAttribute(newAxes[categoryAxisName],"position"))) {this._setBaseAttribute(newAxes[categoryAxisName],"position",categoryPosition);} if(!(this._getBaseAttribute(newAxes[categoryAxisName],"type"))) {this._setBaseAttribute(newAxes[categoryAxisName],"type",this.get("categoryType"));} if(!newAxes.hasOwnProperty(valueAxisName)&&seriesKeys&&seriesKeys.length>0) {newAxes[valueAxisName]={keys:seriesKeys};valueAxes.push(newAxes[valueAxisName]);} if(claimedKeys.length>0) {if(seriesKeys.length>0) {seriesKeys=claimedKeys.concat(seriesKeys);} else {seriesKeys=claimedKeys;}} if(newAxes.hasOwnProperty(valueAxisName)) {if(!(this._getBaseAttribute(newAxes[valueAxisName],"position"))) {this._setBaseAttribute(newAxes[valueAxisName],"position",this._getDefaultAxisPosition(newAxes[valueAxisName],valueAxes,seriesPosition));} if(!(this._getBaseAttribute(newAxes[valueAxisName],"type"))) {this._setBaseAttribute(newAxes[valueAxisName],"type",seriesAxis);} if(!(this._getBaseAttribute(newAxes[valueAxisName],"keys"))) {this._setBaseAttribute(newAxes[valueAxisName],"keys",seriesKeys);}} this.set("seriesKeys",seriesKeys);return newAxes;},_getDefaultAxisPosition:function(axis,valueAxes,position) {var direction=this.get("direction"),i=Y.Array.indexOf(valueAxes,axis);if(valueAxes[i-1]&&valueAxes[i-1].position) {if(direction=="horizontal") {if(valueAxes[i-1].position=="left") {position="right";} else if(valueAxes[i-1].position=="right") {position="left";}} else {if(valueAxes[i-1].position=="bottom") {position="top";} else {position="bottom";}}} return position;},getSeriesItems:function(series,index) {var xAxis=series.get("xAxis"),yAxis=series.get("yAxis"),xKey=series.get("xKey"),yKey=series.get("yKey"),categoryItem,valueItem;if(this.get("direction")=="vertical") {categoryItem={axis:yAxis,key:yKey,value:yAxis.getKeyValueAt(yKey,index)};valueItem={axis:xAxis,key:xKey,value:xAxis.getKeyValueAt(xKey,index)};} else {valueItem={axis:yAxis,key:yKey,value:yAxis.getKeyValueAt(yKey,index)};categoryItem={axis:xAxis,key:xKey,value:xAxis.getKeyValueAt(xKey,index)};} 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) {this._axesRenderQueue=this._axesRenderQueue.splice(1+Y.Array.indexOf(this._axesRenderQueue,e.currentTarget),1);if(this._axesRenderQueue.length<1) {this._redraw();}},_sizeChanged:function(e) {if(this._axesCollection) {var ac=this._axesCollection,i=0,l=ac.length;for(;i-1;--i) {pts[Y.Array.indexOf(this._axesCollection,lc[i])]={x:lw+"px"};lw+=lc[i].get("width");}} if(rc) {l=rc.length;i=0;for(i=l-1;i>-1;--i) {rw+=rc[i].get("width");pts[Y.Array.indexOf(this._axesCollection,rc[i])]={x:(w-rw)+"px"};}} if(tc) {l=tc.length;for(i=l-1;i>-1;--i) {pts[Y.Array.indexOf(this._axesCollection,tc[i])]={y:th+"px"};th+=tc[i].get("height");}} if(bc) {l=bc.length;for(i=l-1;i>-1;--i) {bh+=bc[i].get("height");pts[Y.Array.indexOf(this._axesCollection,bc[i])]={y:(h-bh)+"px"};}} l=this._axesCollection.length;i=0;for(;i0) {this.set("seriesKeys",seriesKeys);}} return{values:{keys:seriesKeys,type:seriesAxis},category:{keys:[catKey],type:this.get("categoryType")}};},getSeriesItems:function(series,index) {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) {this._redraw();},_redraw:function() {var graph=this.get("graph");if(graph) {graph.set("width",this.get("width"));graph.set("height",this.get("height"));}}},{ATTRS:{axes:{getter:function() {return this._axes;},setter:function(val) {this._parseAxes(val);}},seriesCollection:{getter:function() {return this._getSeriesCollection();},setter:function(val) {return this._setSeriesCollection(val);}},type:{value:"pie"}}});function Chart(cfg) {if(cfg.type!="pie") {return new Y.CartesianChart(cfg);} else {return new Y.PieChart(cfg);}} Y.Chart=Chart;},'3.3.0',{requires:['dom','datatype','event-custom','event-mouseenter','widget','widget-position','widget-stack']});