summaryrefslogtreecommitdiffstats
path: root/js/yui3/series-bar-stacked/series-bar-stacked-min.js
blob: 7d3f4f8c9b244e3e9a67b158f4a8355674298c42 (plain)
1
2
3
4
5
6
7
8
/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/

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