//>>built
define("dojox/charting/plot2d/OHLC","dojo/_base/lang,dojo/_base/array,dojo/_base/declare,./CartesianBase,./_PlotEvents,./common,dojox/lang/functional,dojox/lang/functional/reversed,dojox/lang/utils,dojox/gfx/fx".split(","),function(o,z,t,u,v,A,D,E,r,F){var G=E.lambda("item.purgeGroup()");return t("dojox.charting.plot2d.OHLC",[u,v],{defaultParams:{hAxis:"x",vAxis:"y",gap:2,animate:null},optionalParams:{minBarSize:1,maxBarSize:1,stroke:{},outline:{},shadow:{},fill:{},font:"",fontColor:""},constructor:function(a,
b){this.opt=o.clone(this.defaultParams);r.updateWithObject(this.opt,b);r.updateWithPattern(this.opt,b,this.optionalParams);this.series=[];this.hAxis=this.opt.hAxis;this.vAxis=this.opt.vAxis;this.animate=this.opt.animate},collectStats:function(a){for(var b=o.delegate(A.defaultStats),g=0;g<a.length;g++){var d=a[g];if(d.data.length){var c=b.vmin,k=b.vmax;(!("ymin"in d)||!("ymax"in d))&&z.forEach(d.data,function(a,c){if(null!==a){var d=a.x||c+1;b.hmin=Math.min(b.hmin,d);b.hmax=Math.max(b.hmax,d);b.vmin=
Math.min(b.vmin,a.open,a.close,a.high,a.low);b.vmax=Math.max(b.vmax,a.open,a.close,a.high,a.low)}});if("ymin"in d)b.vmin=Math.min(c,d.ymin);if("ymax"in d)b.vmax=Math.max(k,d.ymax)}}return b},getSeriesStats:function(){var a=this.collectStats(this.series);a.hmin-=0.5;a.hmax+=0.5;return a},render:function(a,b){if(this.zoom&&!this.isDataDirty())return this.performZoom(a,b);this.resetEvents();if(this.dirty=this.isDirty()){z.forEach(this.series,G);this._eventSeries={};this.cleanGroup();var g=this.group;
D.forEachRev(this.series,function(a){a.cleanGroup(g)})}var d=this.chart.theme,c,k,o=this._hScaler.scaler.getTransformerFromModel(this._hScaler),p=this._vScaler.scaler.getTransformerFromModel(this._vScaler);k=Math.max(0,this._vScaler.bounds.lower);p(k);var r=this.events();c=A.calculateBarSize(this._hScaler.bounds.scale,this.opt);k=c.gap;c=c.size;for(var w=this.series.length-1;0<=w;--w){var e=this.series[w];if(!this.dirty&&!e.dirty)d.skip(),this._reconnectEvents(e.name);else{e.cleanGroup();for(var t=
d.next("candlestick",[this.opt,e]),g=e.group,B=Array(e.data.length),l=0;l<e.data.length;++l){var f=e.data[l];if(null!==f){var m=d.addMixin(t,"candlestick",f,!0),C=o(f.x||l+0.5)+b.l+k,j=a.height-b.b,h=p(f.open),i=p(f.close),q=p(f.high),n=p(f.low);if(n>q)var x=q,q=n,n=x;if(1<=c){var x={x1:c/2,x2:c/2,y1:j-q,y2:j-n},u={x1:0,x2:c/2+(m.series.stroke.width||1)/2,y1:j-h,y2:j-h},v={x1:c/2-(m.series.stroke.width||1)/2,x2:c,y1:j-i,y2:j-i},y=g.createGroup();y.setTransform({dx:C,dy:0});var s=y.createGroup();s.createLine(x).setStroke(m.series.stroke);
s.createLine(u).setStroke(m.series.stroke);s.createLine(v).setStroke(m.series.stroke);e.dyn.stroke=m.series.stroke;r&&(f={element:"candlestick",index:l,run:e,shape:s,x:C,y:j-Math.max(h,i),cx:c/2,cy:j-Math.max(h,i)+Math.max(h>i?h-i:i-h,1)/2,width:c,height:Math.max(h>i?h-i:i-h,1),data:f},this._connectEvents(f),B[l]=f)}this.animate&&this._animateOHLC(y,j-n,q-n)}}this._eventSeries[e.name]=B;e.dirty=!1}}this.dirty=!1;return this},_animateOHLC:function(a,b,g){F.animateTransform(o.delegate({shape:a,duration:1200,
transform:[{name:"translate",start:[0,b-b/g],end:[0,0]},{name:"scale",start:[1,1/g],end:[1,1]},{name:"original"}]},this.animate)).play()}})});