/*
YUI 3.13.0 (build 508226d)
Copyright 2013 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/

YUI.add("series-column-stacked",function(e,t){var n=e.Lang;e.StackedColumnSeries=e.Base.create("stackedColumnSeries",e.ColumnSeries,[e.StackingUtil],{drawSeries:function(){if(this.get("xcoords").length<1)return;var t=n.isNumber,r=e.clone(this.get("styles").marker),i=r.width,s=r.height,o=this.get("xcoords"),u=this.get("ycoords"),a=0,f=o.length,l=u[0],c=this.get("seriesTypeCollection"),h,p=this.get("order"),d=this.get("graphOrder"),v,m,g,y,b,w,E,S=p===0,x=f*i,T={width:[],height:[]},N=[],C=[],k=this.get("groupMarkers");n.isArray(r.fill.color)&&(g=r.fill.color.concat()),n.isArray(r.border.color)&&(y=r.border.color.concat()),this._createMarkerCache(),x>this.get("width")&&(h=this.get("width")/x,i*=h,i=Math.max(i,1));if(!S){b=c[p-1],w=b.get("negativeBaseValues"),E=b.get("positiveBaseValues");if(!w||!E)S=!0,E=[],w=[]}else w=[],E=[];this.set("negativeBaseValues",w),this.set("positiveBaseValues",E);for(a=0;a<f;++a){v=o[a],l=u[a];if(!t(l)||!t(v)){S&&(w[a]=this._bottomOrigin,E[a]=this._bottomOrigin),this._markers.push(null);continue}S?(s=Math.abs(this._bottomOrigin-l),l<this._bottomOrigin?(E[a]=l,w[a]=this._bottomOrigin):l>this._bottomOrigin?(E[a]=this._bottomOrigin,w[a]=l,l-=s):(E[a]=l,w[a]=l)):l>this._bottomOrigin?(l+=w[a]-this._bottomOrigin,s=l-w[a],w[a]=l,l-=s):l<=this._bottomOrigin&&(l=E[a]-(this._bottomOrigin-l),s=E[a]-l,E[a]=l),!isNaN(s)&&s>0?(v-=i/2,k?(T.width[a]=i,T.height[a]=s,N.push(v),C.push(l)):(r.width=i,r.height=s,r.x=v,r.y=l,g&&(r.fill.color=g[a%g.length]),y&&(r.border.color=y[a%y.length]),m=this.getMarker(r,d,a))):k||this._markers.push(null)}k?this._createGroupMarker({fill:r.fill,border:r.border,dimensions:T,xvalues:N,yvalues:C,shape:r.shape}):this._clearMarkerCache()},updateMarkerState:function(t,r){if(this._markers&&this._markers[r]){var i,s,o=this._getState(t),u=this.get("xcoords"),a=this._markers[r],f=0,l,c;i=this.get("styles").marker,f=i.width*.5,s=o==="off"||!i[o]?e.clone(i):e.clone(i[o]),s.height=a.get("height"),s.x=u[r]-f,s.y=a.get("y"),s.id=a.get("id"),l=s.fill.color,c=s.border.color,n.isArray(l)?s.fill.color=l[r%l.length]:s.fill.color=this._getItemColor(s.fill.color,r),n.isArray(c)?s.border.color=c[r%c.length]:s.border.color=this._getItemColor(s.border.color,r),a.set(s)}},_getPlotDefaults:function(){var e={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}};return e.fill.color=this._getDefaultColor(this.get("graphOrder"),"fill"),e.border.color=this._getDefaultColor(this.get("graphOrder"),"border"),e}},{ATTRS:{type:{value:"stackedColumn"},negativeBaseValues:{value:null},positiveBaseValues:{value:null}}})},"3.13.0",{requires:["series-stacked","series-column"]});
