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