//>>built
define("dojox/charting/plot2d/Candlesticks","dojo/_base/lang dojo/_base/declare dojo/_base/array dojo/has ./CartesianBase ./_PlotEvents ./common dojox/lang/functional dojox/lang/utils dojox/gfx/fx".split(" "),function(x,I,D,J,K,L,y,M,E,N){return I("dojox.charting.plot2d.Candlesticks",[K,L],{defaultParams:{gap:2,animate:null},optionalParams:{minBarSize:1,maxBarSize:1,stroke:{},outline:{},shadow:{},fill:{},font:"",fontColor:""},constructor:function(b,a){this.opt=x.clone(this.defaultParams);E.updateWithObject(this.opt,
a);E.updateWithPattern(this.opt,a,this.optionalParams);this.animate=this.opt.animate},collectStats:function(b){for(var a=x.delegate(y.defaultStats),h=0;h<b.length;h++){var e=b[h];if(e.data.length){var z=a.vmin,p=a.vmax;"ymin"in e&&"ymax"in e||D.forEach(e.data,function(f,g){if(!this.isNullValue(f)){var v=f.x||g+1;a.hmin=Math.min(a.hmin,v);a.hmax=Math.max(a.hmax,v);a.vmin=Math.min(a.vmin,f.open,f.close,f.high,f.low);a.vmax=Math.max(a.vmax,f.open,f.close,f.high,f.low)}},this);"ymin"in e&&(a.vmin=Math.min(z,
e.ymin));"ymax"in e&&(a.vmax=Math.max(p,e.ymax))}}return a},getSeriesStats:function(){var b=this.collectStats(this.series);b.hmin-=.5;b.hmax+=.5;return b},render:function(b,a){if(this.zoom&&!this.isDataDirty())return this.performZoom(b,a);this.resetEvents();this.dirty=this.isDirty();if(this.dirty){D.forEach(this.series,y.purgeGroup);this._eventSeries={};this.cleanGroup();var h=this.getGroup();M.forEachRev(this.series,function(O){O.cleanGroup(h)})}var e=this.chart.theme,z=this._hScaler.scaler.getTransformerFromModel(this._hScaler),
p=this._vScaler.scaler.getTransformerFromModel(this._vScaler),f=this.events();var g=y.calculateBarSize(this._hScaler.bounds.scale,this.opt);var v=g.gap;g=g.size;for(var A=this.series.length-1;0<=A;--A){var c=this.series[A];if(this.dirty||c.dirty){c.cleanGroup();var B=e.next("candlestick",[this.opt,c]),F=Array(c.data.length);if(c.hidden)c.dyn.fill=B.series.fill,c.dyn.stroke=B.series.stroke;else{h=c.group;for(var r=0;r<c.data.length;++r){var d=c.data[r];if(!this.isNullValue(d)){var k=e.addMixin(B,"candlestick",
d,!0),G=z(d.x||r+.5)+a.l+v,n=b.height-a.b,l=p(d.open),m=p(d.close),u=p(d.high),t=p(d.low);if("mid"in d)var H=p(d.mid);if(t>u){var q=u;u=t;t=q}if(1<=g){q=l>m;var P={x1:g/2,x2:g/2,y1:n-u,y2:n-t},Q={x:0,y:n-Math.max(l,m),width:g,height:Math.max(q?l-m:m-l,1)},C=h.createGroup();C.setTransform({dx:G,dy:0});var w=C.createGroup();w.createLine(P).setStroke(k.series.stroke);w.createRect(Q).setStroke(k.series.stroke).setFill(q?k.series.fill:"white");"mid"in d&&w.createLine({x1:k.series.stroke?k.series.stroke.width||
1:1,x2:g-(k.series.stroke?k.series.stroke.width||1:1),y1:n-H,y2:n-H}).setStroke(q?"white":k.series.stroke);c.dyn.fill=k.series.fill;c.dyn.stroke=k.series.stroke;f&&(d={element:"candlestick",index:r,run:c,shape:w,x:G,y:n-Math.max(l,m),cx:g/2,cy:n-Math.max(l,m)+Math.max(q?l-m:m-l,1)/2,width:g,height:Math.max(q?l-m:m-l,1),data:d},this._connectEvents(d),F[r]=d)}this.animate&&this._animateCandlesticks(C,n-t,u-t)}}this._eventSeries[c.name]=F;c.dirty=!1}}else e.skip(),this._reconnectEvents(c.name)}this.dirty=
!1;J("dojo-bidi")&&this._checkOrientation(this.group,b,a);return this},tooltipFunc:function(b){return'\x3ctable cellpadding\x3d"1" cellspacing\x3d"0" border\x3d"0" style\x3d"font-size:0.9em;"\x3e\x3ctr\x3e\x3ctd\x3eOpen:\x3c/td\x3e\x3ctd align\x3d"right"\x3e\x3cstrong\x3e'+b.data.open+'\x3c/strong\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd\x3eHigh:\x3c/td\x3e\x3ctd align\x3d"right"\x3e\x3cstrong\x3e'+b.data.high+'\x3c/strong\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd\x3eLow:\x3c/td\x3e\x3ctd align\x3d"right"\x3e\x3cstrong\x3e'+
b.data.low+'\x3c/strong\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd\x3eClose:\x3c/td\x3e\x3ctd align\x3d"right"\x3e\x3cstrong\x3e'+b.data.close+"\x3c/strong\x3e\x3c/td\x3e\x3c/tr\x3e"+(void 0!==b.data.mid?'\x3ctr\x3e\x3ctd\x3eMid:\x3c/td\x3e\x3ctd align\x3d"right"\x3e\x3cstrong\x3e'+b.data.mid+"\x3c/strong\x3e\x3c/td\x3e\x3c/tr\x3e":"")+"\x3c/table\x3e"},_animateCandlesticks:function(b,a,h){N.animateTransform(x.delegate({shape:b,duration:1200,transform:[{name:"translate",start:[0,a-a/h],end:[0,0]},
{name:"scale",start:[1,1/h],end:[1,1]},{name:"original"}]},this.animate)).play()}})});