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