//>>built
define("dojox/charting/plot2d/Bars","dojo/_base/lang dojo/_base/array dojo/_base/declare dojo/has ./CartesianBase ./_PlotEvents ./common dojox/gfx/fx dojox/lang/utils dojox/lang/functional dojox/lang/functional/reversed".split(" "),function(q,A,H,I,J,K,v,L,w,M,N){var O=N.lambda("item.purgeGroup()"),B=function(){return!1};return H("dojox.charting.plot2d.Bars",[J,K],{defaultParams:{gap:0,animate:null,enableCache:!1},optionalParams:{minBarSize:1,maxBarSize:1,stroke:{},outline:{},shadow:{},fill:{},filter:{},
styleFunc:null,font:"",fontColor:""},constructor:function(a,b){this.opt=q.clone(q.mixin(this.opt,this.defaultParams));w.updateWithObject(this.opt,b);w.updateWithPattern(this.opt,b,this.optionalParams);this.animate=this.opt.animate;this.renderingOptions={"shape-rendering":"crispEdges"}},getSeriesStats:function(){var a=v.collectSimpleStats(this.series,q.hitch(this,"isNullValue")),b;a.hmin-=.5;a.hmax+=.5;b=a.hmin;a.hmin=a.vmin;a.vmin=b;b=a.hmax;a.hmax=a.vmax;a.vmax=b;return a},createRect:function(a,
b,c){var e;this.opt.enableCache&&0<a._rectFreePool.length?(e=a._rectFreePool.pop(),e.setShape(c),b.add(e)):e=b.createRect(c);this.opt.enableCache&&a._rectUsePool.push(e);return e},createLabel:function(a,b,c,e){this.opt.labels&&"outside"==this.opt.labelStyle?this.renderLabel(a,c.x+c.width+this.opt.labelOffset,c.y+c.height/2,this._getLabel(isNaN(b.y)?b:b.y),e,"start"):this.inherited(arguments)},render:function(a,b){if(this.zoom&&!this.isDataDirty())return this.performZoom(a,b);this.dirty=this.isDirty();
this.resetEvents();var c;this.dirty&&(A.forEach(this.series,O),this._eventSeries={},this.cleanGroup(),c=this.getGroup(),M.forEachRev(this.series,function(a){a.cleanGroup(c)}));var e=this.chart.theme,h=this._hScaler.scaler.getTransformerFromModel(this._hScaler),g=this._vScaler.scaler.getTransformerFromModel(this._vScaler),k=Math.max(this._hScaler.bounds.lower,this._hAxis?this._hAxis.naturalBaseline:0),l=h(k),P=this.events(),C=this.getBarProperties(),E=this.series.length;A.forEach(this.series,function(a){a.hidden&&
E--});for(var v=E,F=this.extractValues(this._vScaler),F=this.rearrangeValues(F,h,l),x=0;x<this.series.length;x++){var d=this.series[x];if(this.dirty||d.dirty){d.cleanGroup();this.opt.enableCache&&(d._rectFreePool=(d._rectFreePool?d._rectFreePool:[]).concat(d._rectUsePool?d._rectUsePool:[]),d._rectUsePool=[]);var D=e.next("bar",[this.opt,d]);if(d.hidden)d.dyn.fill=D.series.fill,d.dyn.stroke=D.series.stroke;else{v--;var w=Array(d.data.length);c=d.group;for(var y=A.some(d.data,function(a){return"number"==
typeof a||a&&!a.hasOwnProperty("x")}),B=y?Math.min(d.data.length,Math.ceil(this._vScaler.bounds.to)):d.data.length,m=y?Math.max(0,Math.floor(this._vScaler.bounds.from-1)):0;m<B;++m){var t=d.data[m];if(!this.isNullValue(t)){var u=this.getValue(t,m,x,y),z=F[x][m],f,p;this.opt.styleFunc||"number"!=typeof t?(f="number"!=typeof t?[t]:[],this.opt.styleFunc&&f.push(this.opt.styleFunc(t)),f=e.addMixin(D,"bar",f,!0)):f=e.post(D,"bar");if(z&&1<=C.height){var r={x:b.l+l+Math.min(z,0),y:a.height-b.b-g(u.x+1.5)+
C.gap+C.thickness*(E-v-1),width:Math.abs(z),height:C.height};f.series.shadow&&(p=q.clone(r),p.x+=f.series.shadow.dx,p.y+=f.series.shadow.dy,p=this.createRect(d,c,p).setFill(f.series.shadow.color).setStroke(f.series.shadow),this.animate&&this._animateBar(p,b.l+l,-z));var n=this._plotFill(f.series.fill,a,b),n=this._shapeFill(n,r),n=this.createRect(d,c,r).setFill(n).setStroke(f.series.stroke);n.setFilter&&f.series.filter&&n.setFilter(f.series.filter);d.dyn.fill=n.getFill();d.dyn.stroke=n.getStroke();
if(P){var G={element:"bar",index:m,run:d,shape:n,shadow:p,cx:u.y,cy:u.x+1.5,x:y?m:d.data[m].x,y:y?d.data[m]:d.data[m].y};this._connectEvents(G);w[m]=G}!isNaN(u.py)&&u.py>k&&(r.x+=h(u.py),r.width-=h(u.py));this.createLabel(c,t,r,f);this.animate&&this._animateBar(n,b.l+l,-Math.abs(z))}}}this._eventSeries[d.name]=w;d.dirty=!1}}else e.skip(),this._reconnectEvents(d.name)}this.dirty=!1;I("dojo-bidi")&&this._checkOrientation(this.group,a,b);return this},getValue:function(a,b,c,e){e?(c="number"==typeof a?
a:a.y,a=b):(c=a.y,a=a.x-1);return{y:c,x:a}},extractValues:function(a){for(var b=[],c=this.series.length-1;0<=c;--c){var e=this.series[c];if(this.dirty||e.dirty){var h=A.some(e.data,function(a){return"number"==typeof a||a&&!a.hasOwnProperty("x")}),g=h?Math.max(0,Math.floor(a.bounds.from-1)):0,h=h?Math.min(e.data.length,Math.ceil(a.bounds.to)):e.data.length,k=b[c]=[];k.min=g;for(k.max=h;g<h;++g){var l=e.data[g];k[g]=this.isNullValue(l)?0:"number"==typeof l?l:l.y}}}return b},rearrangeValues:function(a,
b,c){for(var e=0,h=a.length;e<h;++e){var g=a[e];if(g)for(var k=g.min,l=g.max;k<l;++k){var q=g[k];g[k]=this.isNullValue(q)?0:b(q)-c}}return a},isNullValue:function(a){if(null===a||"undefined"==typeof a)return!0;var b=this._hAxis?this._hAxis.isNullValue:B,c=this._vAxis?this._vAxis.isNullValue:B;return"number"==typeof a?c(.5)||b(a):c(isNaN(a.x)?.5:a.x+.5)||null===a.y||b(a.y)},getBarProperties:function(){var a=v.calculateBarSize(this._vScaler.bounds.scale,this.opt);return{gap:a.gap,height:a.size,thickness:0}},
_animateBar:function(a,b,c){0==c&&(c=1);L.animateTransform(q.delegate({shape:a,duration:1200,transform:[{name:"translate",start:[b-b/c,0],end:[0,0]},{name:"scale",start:[1/c,1],end:[1,1]},{name:"original"}]},this.animate)).play()}})});