//>>built
define("dojox/charting/plot2d/OHLC","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(w,C,G,H,I,J,x,K,D,L){return G("dojox.charting.plot2d.OHLC",[I,J],{defaultParams:{gap:2,animate:null},optionalParams:{minBarSize:1,maxBarSize:1,stroke:{},outline:{},shadow:{},fill:{},font:"",fontColor:""},constructor:function(b,a){this.opt=w.clone(this.defaultParams);D.updateWithObject(this.opt,
a);D.updateWithPattern(this.opt,a,this.optionalParams);this.animate=this.opt.animate},collectStats:function(b){for(var a=w.delegate(x.defaultStats),h=0;h<b.length;h++){var d=b[h];if(d.data.length){var y=a.vmin,p=a.vmax;"ymin"in d&&"ymax"in d||C.forEach(d.data,function(e,c){if(!this.isNullValue(e)){var u=e.x||c+1;a.hmin=Math.min(a.hmin,u);a.hmax=Math.max(a.hmax,u);a.vmin=Math.min(a.vmin,e.open,e.close,e.high,e.low);a.vmax=Math.max(a.vmax,e.open,e.close,e.high,e.low)}},this);"ymin"in d&&(a.vmin=Math.min(y,
d.ymin));"ymax"in d&&(a.vmax=Math.max(p,d.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();if(this.dirty=this.isDirty()){C.forEach(this.series,x.purgeGroup);this._eventSeries={};this.cleanGroup();var h=this.getGroup();K.forEachRev(this.series,function(M){M.cleanGroup(h)})}var d=this.chart.theme,y=this._hScaler.scaler.getTransformerFromModel(this._hScaler),
p=this._vScaler.scaler.getTransformerFromModel(this._vScaler),e=this.events();var c=x.calculateBarSize(this._hScaler.bounds.scale,this.opt);var u=c.gap;c=c.size;for(var z=0;z<this.series.length;z++){var f=this.series[z];if(this.dirty||f.dirty){f.cleanGroup();var N=d.next("candlestick",[this.opt,f]);h=f.group;for(var E=Array(f.data.length),q=0;q<f.data.length;++q){var g=f.data[q];if(!this.isNullValue(g)){var n=d.addMixin(N,"candlestick",g,!0),F=y(g.x||q+.5)+a.l+u,m=b.height-a.b,k=p(g.open),l=p(g.close),
t=p(g.high),r=p(g.low);if(r>t){var A=t;t=r;r=A}if(1<=c){A={x1:c/2,x2:c/2,y1:m-t,y2:m-r};var O={x1:0,x2:c/2+(n.series.stroke?n.series.stroke.width||1:1)/2,y1:m-k,y2:m-k},P={x1:c/2-(n.series.stroke?n.series.stroke.width||1:1)/2,x2:c,y1:m-l,y2:m-l},B=h.createGroup();B.setTransform({dx:F,dy:0});var v=B.createGroup();v.createLine(A).setStroke(n.series.stroke);v.createLine(O).setStroke(n.series.stroke);v.createLine(P).setStroke(n.series.stroke);f.dyn.stroke=n.series.stroke;e&&(g={element:"candlestick",
index:q,run:f,shape:v,x:F,y:m-Math.max(k,l),cx:c/2,cy:m-Math.max(k,l)+Math.max(k>l?k-l:l-k,1)/2,width:c,height:Math.max(k>l?k-l:l-k,1),data:g},this._connectEvents(g),E[q]=g)}this.animate&&this._animateOHLC(B,m-r,t-r)}}this._eventSeries[f.name]=E;f.dirty=!1}else d.skip(),this._reconnectEvents(f.name)}this.dirty=!1;H("dojo-bidi")&&this._checkOrientation(this.group,b,a);return this},_animateOHLC:function(b,a,h){L.animateTransform(w.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()}})});