/*
    *
    * Wijmo Library 5.20173.409
    * http://wijmo.com/
    *
    * Copyright(c) GrapeCity, Inc.  All rights reserved.
    *
    * Licensed under the GrapeCity Commercial License.
    * sales@wijmo.com
    * wijmo.com/products/wijmo-5/license/
    *
    */
System.register(["wijmo/wijmo","wijmo/wijmo.chart","wijmo/wijmo.chart.finance","wijmo/wijmo.chart.finance.analytics"],function(t,e){"use strict";function i(t){return isFinite(t)&&!isNaN(t)&&u.isNumber(t)}function s(t,e,i,s,a){u.asArray(t,!1),u.asArray(e,!1),u.asArray(i,!1),u.asInt(s,!1,!0),u.asNumber(a,!1,!0);var n,l,r=c._minimum(t.length,e.length,i.length),o=[],h=[],_=[];for(u.assert(r>s&&s>1,"CCI period must be an integer less than the length of the data and greater than one."),l=0;l<r;l++)o.push(c._average(t[l],e[l],i[l]));n=c._sma(o,s);var p;for(l=0;l<n.length;l++)p=o.slice(l,s+l).reduce(function(t,e){return t+Math.abs(n[l]-e)},0),h.push(p/s);for(o.splice(0,s-1),l=0;l<n.length;l++)_.push((o[l]-n[l])/(a*h[l]));return _}function a(t,e,i,s){u.asArray(t,!1),u.asArray(e,!1),u.asArray(i,!1),u.asInt(s,!1,!0);var a,n=c._minimum(t.length,e.length,i.length),l=[],r=[],o=[];for(u.assert(n>s&&s>1,"Williams %R period must be an integer less than the length of the data and greater than one."),a=s;a<=t.length;a++)l.push(c._maximum(t.slice(a-s,a))),r.push(c._minimum(e.slice(a-s,a)));for(i.splice(0,s-1),a=0;a<l.length;a++)o.push((l[a]-i[a])/(l[a]-r[a])*-100);return o}function n(t,e,i){u.asArray(t,!1),u.asInt(e,!1,!0),u.asNumber(i,!1,!0),u.assert(t.length>e&&e>1,"Bollinger Bands period must be an integer less than the length of the data and greater than one.");var s,a=c._sma(t,e),n=[];for(s=e;s<=t.length;s++)n.push(c._stdDeviation(t.slice(s-e,s)));var l=a,r=a.map(function(t,e){return t+n[e]*i});return{lowers:a.map(function(t,e){return t-n[e]*i}),middles:l,uppers:r}}function l(t,e){u.asArray(t,!1),u.asInt(e,!0,!1),u.assert(t.length>e&&e>1,"RSI period must be an integer less than the length of the data and greater than one.");var i,s,a,n,l=[],r=[],o=[],h=[];for(n=1;n<t.length;n++)l.push(t[n]-t[n-1]);for(i=l.map(function(t){return t>0?t:0}),s=l.map(function(t){return t<0?Math.abs(t):0}),n=e;n<=l.length;n++)n===e?(r.push(c._sum(i.slice(n-e,n))/e),o.push(c._sum(s.slice(n-e,n))/e)):(r.push((i[n-1]+r[n-e-1]*(e-1))/e),o.push((s[n-1]+o[n-e-1]*(e-1))/e)),a=r[n-e]/o[n-e],a=isFinite(a)?a:0,h.push(100-100/(1+a));return h}function r(t,e,i,s){u.asArray(t,!1),u.asInt(e,!1,!0),u.asInt(i,!1,!0),u.asInt(s,!1,!0);var a,n=e>i;n&&(a=i,i=e,e=a);var l,r,o=c._ema(t,e),h=c._ema(t,i),_=[],p=[];for(o.splice(0,i-e),r=0;r<o.length;r++)a=o[r]-h[r],n&&(a*=-1),_.push(a);l=c._ema(_,s);var d=_.slice(_.length-l.length,_.length);for(r=0;r<d.length;r++)p.push(d[r]-l[r]);return{macds:_,signals:l,histograms:p}}function o(t,e,i,s,a,n){u.asArray(t,!1),u.asArray(e,!1),u.asArray(i,!1),u.asInt(s,!1,!0),u.asInt(a,!1,!0),u.asInt(n,!0,!0);var l,r,o=[],h=[],_=[];for(r=s;r<=t.length;r++)o.push(c._maximum(t.slice(r-s,r))),h.push(c._minimum(e.slice(r-s,r)));for(i=i.slice(s-1),r=0;r<i.length;r++)_.push((i[r]-h[r])/(o[r]-h[r])*100);return n&&n>1&&(_=c._sma(_,n)),l=c._sma(_,a),{ks:_,ds:l}}var h=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function s(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}();e&&e.id;t("_cci",s),t("_williamsR",a),t("_bollingerBands",n),t("_rsi",l),t("_macd",r),t("_stochastic",o);var u,_,c,p,d,g,f,y,m,v,V,b,x,P,w,k,L,X,M,I,B;return{setters:[function(t){u=t},function(t){_=t},function(t){c=t},function(t){p=t}],execute:function(){window.wijmo=window.wijmo||{},window.wijmo.chart=window.wijmo.chart||{},window.wijmo.chart.finance=window.wijmo.chart.finance||{},window.wijmo.chart.finance.analytics=p,d=function(t){function e(e){var i=t.call(this)||this;return i._levels=[0,23.6,38.2,50,61.8,100],i._uptrend=!0,i._labelPosition=_.LabelPosition.Left,i.rendering.addHandler(i._render),i.initialize(e),i}return h(e,t),Object.defineProperty(e.prototype,"low",{get:function(){return this._low},set:function(t){t!=this._low&&(this._low=u.asNumber(t,!0),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"high",{get:function(){return this._high},set:function(t){t!=this._high&&(this._high=u.asNumber(t,!0),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"labelPosition",{get:function(){return this._labelPosition},set:function(t){t!=this._labelPosition&&(this._labelPosition=u.asEnum(t,_.LabelPosition,!0),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uptrend",{get:function(){return this._uptrend},set:function(t){t!=this._uptrend&&(this._uptrend=u.asBoolean(t,!0),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"levels",{get:function(){return this._levels},set:function(t){t!=this._levels&&(this._levels=u.asArray(t,!0),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minX",{get:function(){return this._minX},set:function(t){t!=this._minX&&(this._minX=t,this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxX",{get:function(){return this._maxX},set:function(t){t!=this._maxX&&(this._maxX=t,this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._getMinX=function(){return u.isNumber(this._minX)?this._minX:u.isDate(this._minX)?u.asDate(this._minX).valueOf():this._getAxisX().actualMin},e.prototype._getMaxX=function(){return u.isNumber(this._maxX)?this._maxX:u.isDate(this._maxX)?u.asDate(this._maxX).valueOf():this._getAxisX().actualMax},e.prototype._updateLevels=function(){var e=void 0,i=void 0;if(void 0===this._low||void 0===this._high){var s=t.prototype.getValues.call(this,0),a=t.prototype.getValues.call(this,1);if(s)for(var n=s.length,l=this._getMinX(),r=this._getMaxX(),o=0;o<n;o++){var h=s[o],u=a?a[o]:o;u<l||u>r||(isNaN(h)||((void 0===e||e>h)&&(e=h),(void 0===i||i<h)&&(i=h)))}}void 0===this._low&&void 0!==e?this._actualLow=e:this._actualLow=this._low,void 0===this._high&&void 0!==i?this._actualHigh=i:this._actualHigh=this._high},e.prototype._render=function(t,e){e.cancel=!0;var i=t;i._updateLevels();var s=i._getAxisX(),a=i._getAxisY(),n=e.engine,l=i._getSymbolStroke(i._chart.series.indexOf(i)),r=_._BasePlotter.cloneStyle(i.style,["fill"]),o=_._BasePlotter.cloneStyle(i.style,["stroke"]),h=i.chart._plotrectId;n.stroke=l,n.strokeWidth=2,n.textFill=l;var c=i._getMinX(),p=i._getMaxX();c<s.actualMin&&(c=s.actualMin),p>s.actualMax&&(p=s.actualMax),n.startGroup(null,h);for(var d=i._levels?i._levels.length:0,g=0;g<d;g++){var f=i._levels[g],y=s.convert(c),m=s.convert(p),v=i.uptrend?a.convert(i._actualLow+.01*f*(i._actualHigh-i._actualLow)):a.convert(i._actualHigh-.01*f*(i._actualHigh-i._actualLow));if(_._DataInfo.isValid(y)&&_._DataInfo.isValid(m)&&_._DataInfo.isValid(v)&&(n.drawLine(y,v,m,v,null,r),i.labelPosition!=_.LabelPosition.None)){var V=f.toFixed(1)+"%",b=0;switch((i.uptrend&&0==g||!i.uptrend&&g==d-1)&&(b=2),i.labelPosition){case _.LabelPosition.Left:_.FlexChartCore._renderText(n,V,new u.Point(y,v),0,b,null,null,o);break;case _.LabelPosition.Center:_.FlexChartCore._renderText(n,V,new u.Point(.5*(y+m),v),1,b,null,null,o);break;case _.LabelPosition.Right:_.FlexChartCore._renderText(n,V,new u.Point(m,v),2,b,null,null,o)}}}n.stroke=null,n.strokeWidth=null,n.textFill=null,n.endGroup()},e.prototype._getChartType=function(){return _.ChartType.Line},e}(_.SeriesBase),t("Fibonacci",d),g=function(t){function e(e){var i=t.call(this)||this;return i._levels=[38.2,50,61.8],i._labelPosition=_.LabelPosition.Top,i.rendering.addHandler(i._render,i),i.initialize(e),i}return h(e,t),Object.defineProperty(e.prototype,"start",{get:function(){return this._start},set:function(t){t!==this.start&&(this._start=u.asType(t,_.DataPoint),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},set:function(t){t!==this.end&&(this._end=u.asType(t,_.DataPoint),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"levels",{get:function(){return this._levels},set:function(t){t!==this._levels&&(this._levels=u.asArray(t,!1),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"labelPosition",{get:function(){return this._labelPosition},set:function(t){t!==this.labelPosition&&(this._labelPosition=u.asEnum(t,_.LabelPosition),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._render=function(e,s){s.cancel=!0;var a=this._getX(0),n=this._getY(0),l=this._getX(1),r=this._getY(1);if(!(t.prototype._getLength.call(this)<=1)&&i(a)&&i(n)&&i(l)&&i(r)){var o,h=this._getAxisX(),c=this._getAxisY(),p=s.engine,d=this.chart.series.indexOf(this),g=this._getSymbolStroke(d),f=_._BasePlotter.cloneStyle(this.style,["fill"]),y=_._BasePlotter.cloneStyle(this.style,["stroke"]);p.stroke=g,p.strokeWidth=2,p.textFill=g;var m,v,V,b,x,P,w,k,L,X=this.chart._plotrectId,M=r-n;o=p.startGroup(null,X),u.addClass(o,"fibonacci-arcs"),i(a)&&i(n)&&i(l)&&i(r)&&p.drawLines([h.convert(a),h.convert(l)],[c.convert(n),c.convert(r)],null,f),b=Math.sqrt(Math.pow(h.convert(l)-h.convert(a),2)+Math.pow(c.convert(r)-c.convert(n),2)),P=new u.Point(l,r);for(var I=0;I<this.levels.length;I++)if(w=.01*this.levels[I],x=Math.abs(b*w),i(P.x)&&i(P.y)&&i(x)&&(m=h.convert(P.x),v=c.convert(P.y),p.drawDonutSegment(m,v,x,x,M>0?0:Math.PI,Math.PI,null,f),this.labelPosition!==_.LabelPosition.None&&0!==w)){switch(L=u.Globalize.format(w,"p1"),k=p.measureString(L,null,null,y),V=M<=0?v-x:v+x,this.labelPosition){case _.LabelPosition.Center:V+=.5*k.height;break;case _.LabelPosition.Bottom:V+=M<=0?k.height:0;break;default:V+=M<=0?0:k.height}p.drawString(L,new u.Point(m-.5*k.width,V),null,y)}p.stroke=null,p.strokeWidth=null,p.textFill=null,p.endGroup()}},e.prototype._getX=function(t){var e=null;return 0===t&&this.start?e=this.start.x:1===t&&this.end&&(e=this.end.x),u.isDate(e)&&(e=u.asDate(e).valueOf()),e},e.prototype._getY=function(t){var e=null;return 0===t&&this.start?e=this.start.y:1===t&&this.end&&(e=this.end.y),e},e.prototype._getChartType=function(){return _.ChartType.Line},e}(_.SeriesBase),t("FibonacciArcs",g),f=function(t){function e(e){var i=t.call(this)||this;return i._levels=[0,23.6,38.2,50,61.8,100],i._labelPosition=_.LabelPosition.Top,i.rendering.addHandler(i._render,i),i.initialize(e),i}return h(e,t),Object.defineProperty(e.prototype,"start",{get:function(){return this._start},set:function(t){t!==this.start&&(this._start=u.asType(t,_.DataPoint),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},set:function(t){t!==this.end&&(this._end=u.asType(t,_.DataPoint),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"levels",{get:function(){return this._levels},set:function(t){t!==this._levels&&(this._levels=u.asArray(t,!1),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"labelPosition",{get:function(){return this._labelPosition},set:function(t){t!==this.labelPosition&&(this._labelPosition=u.asEnum(t,_.LabelPosition),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._updateLevels=function(){if(!this.start||!this.end){var e,s,a,n,l=this.chart._getPlotter(this),r=this._getAxisX(),o=t.prototype.getValues.call(this,0),h=t.prototype.getValues.call(this,1)||l.dataInfo.getXVals();o&&o.length>0&&(a=c._minimum(o),n=c._maximum(o)),h&&h.length>0?(e=c._minimum(h),s=c._maximum(h)):(e=r.actualMin,s=r.actualMax),i(e)&&i(a)&&i(s)&&i(n)&&(this.start=new _.DataPoint(e,a),this.end=new _.DataPoint(s,n))}},e.prototype._render=function(e,s){s.cancel=!0,this._updateLevels();var a=this._getX(0),n=this._getY(0),l=this._getX(1),r=this._getY(1);if(!(t.prototype._getLength.call(this)<=1)&&i(a)&&i(n)&&i(l)&&i(r)){var o=this._getAxisX(),h=this._getAxisY(),c=this.chart.series.indexOf(this),p=s.engine,d=this._getSymbolStroke(c),g=_._BasePlotter.cloneStyle(this.style,["fill"]),f=_._BasePlotter.cloneStyle(this.style,["stroke"]);p.stroke=d,p.strokeWidth=2,p.textFill=d;var y,m,v,V,b,x,P,w,k,L,X,M,I,B=r-n,C=l-a,D=this.chart._plotrectId;y=a,v=n,V=r;var Y=m=l;p.startGroup(null,D);for(var O=0;O<this.levels.length;O++)if(m=C<0?o.actualMin:o.actualMax,L=.01*this.levels[O],V=v+L*B,w=(V-v)/(Y-y),k=V-w*Y,V=w*m+k,B>0&&V>h.actualMax?m=((V=h.actualMax)-k)/w:B<0&&V<h.actualMin&&(m=((V=h.actualMin)-k)/w),i(y)&&i(v)&&i(m)&&i(V)&&(b=new u.Point(o.convert(y),h.convert(v)),x=new u.Point(o.convert(m),h.convert(V)),p.drawLines([b.x,x.x],[b.y,x.y],null,g),this.labelPosition!=_.LabelPosition.None)){X=u.Globalize.format(L,"p1"),M=p.measureString(X,null,null,f),I=180*Math.atan((x.y-b.y)/(x.x-b.x))/Math.PI,P=x.clone(),x.x=C>0?x.x-M.width:x.x;var S,j=I*Math.PI/180,A=new u.Point,T=new u.Point,W=new u.Point,N=new u.Point,z=h.convert(h.actualMin),R=h.convert(h.actualMax),F=o.convert(o.actualMin),H=o.convert(o.actualMax),E=P.clone();switch(this.labelPosition){case _.LabelPosition.Center:x.y+=.5*M.height,E.y+=.5*M.height;break;case _.LabelPosition.Bottom:x.y+=M.height}C>0?(this.labelPosition===_.LabelPosition.Top||this.labelPosition===_.LabelPosition.Center?(N=E.clone(),W.x=N.x+M.height*Math.sin(j),W.y=N.y-M.height*Math.cos(j),A.x=N.x-M.width*Math.cos(j)+M.height*Math.sin(j),A.y=N.y-M.width*Math.sin(j)-M.height*Math.cos(j),T.x=N.x-M.width*Math.cos(j),T.y=N.y-M.width*Math.sin(j)):this.labelPosition===_.LabelPosition.Bottom&&(W=E.clone(),A.x=W.x-M.width*Math.cos(j),A.y=W.y-M.width*Math.sin(j),T.x=A.x-M.height*Math.sin(j),T.y=A.y+M.height*Math.cos(j),N.x=A.x+M.width*Math.cos(j)-M.height*Math.sin(j),N.y=A.y+M.width*Math.sin(j)+M.height*Math.cos(j)),B>0?(W.y<R&&(w=(h.convertBack(W.y)-h.convertBack(A.y))/(o.convertBack(W.x)-o.convertBack(A.x)),k=h.convertBack(W.y)-w*o.convertBack(W.x),S=o.convert((h.actualMax-k)/w),x.x-=Math.abs(W.x-S)),N.x>H&&(x.x-=Math.abs(H-N.x))):B<0&&(N.y>z&&(w=(h.convertBack(T.y)-h.convertBack(N.y))/(o.convertBack(T.x)-o.convertBack(N.x)),k=h.convertBack(N.y)-w*o.convertBack(N.x),S=o.convert((h.actualMin-k)/w),x.x-=Math.max(Math.abs(S-N.x),Math.abs(z-N.y))),W.x>H&&(x.x-=Math.abs(H-W.x)))):C<0&&(this.labelPosition===_.LabelPosition.Top||this.labelPosition===_.LabelPosition.Center?(T=E.clone(),A.x=T.x+M.height*Math.sin(j),A.y=T.y-M.height*Math.cos(j),N.x=T.x+M.width*Math.cos(j),N.y=T.y+M.width*Math.sin(j),W.x=A.x+M.width*Math.cos(j),W.y=A.y+M.width*Math.sin(j)):this.labelPosition===_.LabelPosition.Bottom&&(A=E.clone(),W.x=A.x+M.width*Math.cos(j),W.y=A.y+M.width*Math.sin(j),T.x=A.x-M.height*Math.sin(j),T.y=A.y+M.height*Math.cos(j),N.x=A.x+M.width*Math.cos(j)-M.height*Math.sin(j),N.y=A.y+M.width*Math.sin(j)+M.height*Math.cos(j)),B>0?(A.y<R&&(w=(h.convertBack(A.y)-h.convertBack(W.y))/(o.convertBack(A.x)-o.convertBack(W.x)),k=h.convertBack(A.y)-w*o.convertBack(A.x),S=o.convert((h.actualMax-k)/w),x.x+=Math.abs(A.x-S)),T.x<F&&(x.x+=Math.abs(F-T.x))):B<0&&(T.y>z&&(w=(h.convertBack(N.y)-h.convertBack(T.y))/(o.convertBack(N.x)-o.convertBack(T.x)),k=h.convertBack(T.y)-w*o.convertBack(T.x),S=o.convert((h.actualMin-k)/w),x.x+=Math.max(Math.abs(S-T.x),Math.abs(z-T.y))),A.x<F&&(x.x+=Math.abs(F-A.x)))),0===I?p.drawString(X,x,null,f):p.drawStringRotated(X,x,P,I,null,f)}p.stroke=null,p.strokeWidth=null,p.textFill=null,p.endGroup()}},e.prototype._getX=function(t){var e=null;return 0===t&&this.start?e=this.start.x:1===t&&this.end&&(e=this.end.x),u.isDate(e)&&(e=u.asDate(e).valueOf()),e},e.prototype._getY=function(t){var e=null;return 0===t&&this.start?e=this.start.y:1===t&&this.end&&(e=this.end.y),e},e.prototype._getChartType=function(){return _.ChartType.Line},e}(_.SeriesBase),t("FibonacciFans",f),y=function(t){function e(e){var i=t.call(this)||this;return i._levels=[0,1,2,3,5,8,13,21,34],i._labelPosition=_.LabelPosition.Right,i.rendering.addHandler(i._render,i),i.initialize(e),i}return h(e,t),Object.defineProperty(e.prototype,"startX",{get:function(){return this._startX},set:function(t){t!==this.startX&&(u.isDate(t)?this._startX=u.asDate(t):this._startX=u.asNumber(t),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endX",{get:function(){return this._endX},set:function(t){t!==this.endX&&(u.isDate(t)?this._endX=u.asDate(t):this._endX=u.asNumber(t),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"levels",{get:function(){return this._levels},set:function(t){t!==this._levels&&(this._levels=u.asArray(t,!1),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"labelPosition",{get:function(){return this._labelPosition},set:function(t){t!==this.labelPosition&&(this._labelPosition=u.asEnum(t,_.LabelPosition),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._render=function(e,s){s.cancel=!0,this._updateLevels();var a=this._getX(0),n=this._getX(1);if(!(t.prototype._getLength.call(this)<=1)&&i(a)&&i(n)){var l,r,o,h,c=n-a,p=this._getAxisX(),d=this._getAxisY(),g=this._chart.series.indexOf(this),f=s.engine,y=this._getSymbolStroke(g),m=_._BasePlotter.cloneStyle(this.style,["fill"]),v=_._BasePlotter.cloneStyle(this.style,["stroke"]),V=d.convert(d.actualMin),b=d.convert(d.actualMax),x=this.chart._plotrectId;if(f.stroke=y,f.strokeWidth=2,f.textFill=y,0!==c){f.startGroup(null,x);for(var P=0;P<this.levels.length;P++)if(l=this.levels[P],!((r=c*l+a)<p.actualMin||p.actualMax<r)&&i(r)&&(r=p.convert(r),f.drawLine(r,V,r,b,null,m),this.labelPosition!==_.LabelPosition.None)){switch(h=u.Globalize.format(l,"n0"),o=f.measureString(h,null,null,v),this.labelPosition){case _.LabelPosition.Left:r-=o.width+2;break;case _.LabelPosition.Center:r-=o.width/2;break;case _.LabelPosition.Right:r+=2;break;default:r=c<0?r-o.width-2:r+2}f.drawString(h,new u.Point(r,V),null,v)}f.stroke=null,f.strokeWidth=null,f.textFill=null,f.endGroup()}}},e.prototype._updateLevels=function(){var e=this.chart._getPlotter(this),i=t.prototype.getValues.call(this,1)||e.dataInfo.getXVals();if(!(t.prototype._getLength.call(this)<=1)){var s=this._getX(0),a=this._getX(1),n=u.isNumber(s)&&u.isNumber(a);n||i?!n&&i&&(this._startX=i[0],this._endX=i[1]):(this._startX=0,this._endX=1)}},e.prototype._getX=function(t){var e=null;return 0===t?e=this.startX:1===t&&(e=this.endX),u.isDate(e)&&(e=u.asDate(e).valueOf()),e},e.prototype._getChartType=function(){return _.ChartType.Line},e}(_.SeriesBase),t("FibonacciTimeZones",y),m=function(t){function e(e){var i=t.call(this,e)||this;return i._seriesCount=1,i}return h(e,t),Object.defineProperty(e.prototype,"_hitTester",{get:function(){return this._plotter&&!this.__hitTester&&(this.__hitTester=this._plotter.hitTester),this.__hitTester},enumerable:!0,configurable:!0}),e.prototype._getChartType=function(){return _.ChartType.Line},e.prototype._getXValues=function(){return t.prototype.getValues.call(this,1)||this._plotter.dataInfo.getXVals()},e.prototype._getDataPoint=function(t,e,i,s,a,n){var l=new _._DataPoint(i,s,t,e);return l.y=e,l.yfmt=n._formatValue(e),l.x=t,l.xfmt=a._formatValue(t),l},e.prototype._shouldCalculate=function(){return!0},e.prototype._init=function(){},e.prototype._calculate=function(){},e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this.__hitTester=null},e.prototype._getName=function(t){var e=void 0;if(this.name)if(this.name.indexOf(",")){var i=this.name.split(",");i&&i.length-1>=t&&(e=i[t].trim())}else e=this.name;return e},e.prototype._getStyles=function(t){var e=null;if(t<0||null===this._styles)return e;var i=0;for(var s in this._styles){if(i===t&&this._styles.hasOwnProperty(s)){e=this._styles[s];break}i++}return e},e.prototype.legendItemLength=function(){return this._seriesCount},e.prototype.measureLegendItem=function(t,e){var i=this._getName(e),s=new u.Size(0,0);return i&&(s=this._measureLegendItem(t,this._getName(e))),s},e.prototype.drawLegendItem=function(t,e,i){var s=this._getStyles(i)||this.style;this._getName(i)&&this._drawLegendItem(t,e,this._getChartType(),this._getName(i),s,this.symbolStyle)},e}(_.SeriesBase),t("OverlayIndicatorBase",m),v=function(t){function e(e){var i=t.call(this,e)||this;return i._period=14,i}return h(e,t),Object.defineProperty(e.prototype,"period",{get:function(){return this._period},set:function(t){t!==this._period&&(this._period=u.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype.getValues=function(e){var i=null;return t.prototype._getLength.call(this)<=0?i:(this._shouldCalculate()&&(this._init(),this._calculate()),0===e?i=this._yvals:1===e&&(i=this._xvals),i)},e.prototype.getDataRect=function(e,i){if(i)return i;var s=null;if(t.prototype._getLength.call(this)<=0)return s;this._shouldCalculate()&&(this._init(),this._calculate());var a=c._minimum(this._xvals),n=c._maximum(this._xvals),l=c._minimum(this._yvals),r=c._maximum(this._yvals);return _._DataInfo.isValid(a)&&_._DataInfo.isValid(n)&&_._DataInfo.isValid(l)&&_._DataInfo.isValid(r)&&(s=new u.Rect(a,l,n-a,r-l)),s},e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this._xvals=null,this._yvals=null},e.prototype._shouldCalculate=function(){return!this._yvals||!this._xvals},e.prototype._init=function(){t.prototype._init.call(this),this._yvals=[],this._xvals=[]},e.prototype._getItem=function(e){return t.prototype._getLength.call(this)<=0?t.prototype._getItem.call(this,e):(this._shouldCalculate()&&(this._init(),this._calculate()),e=t.prototype._getLength.call(this)-c._minimum(this._yvals.length,this._xvals.length)+e,t.prototype._getItem.call(this,e))},e}(m),t("SingleOverlayIndicatorBase",v),V=function(t){function e(e){var i=t.call(this)||this;return i.period=14,i.initialize(e),i}return h(e,t),e.prototype._calculate=function(){if(!(t.prototype._getLength.call(this)<=0)){var e=t.prototype._getBindingValues.call(this,0),i=t.prototype._getBindingValues.call(this,1),s=t.prototype._getBindingValues.call(this,3),a=this._getXValues();this._yvals=c._avgTrueRng(e,i,s,this.period),this._xvals=a?a.slice(this.period-1):c._range(this.period-1,e.length)}},e}(v),t("ATR",V),b=function(t){function e(e){var i=t.call(this)||this;return i._constant=.015,i.period=20,i.initialize(e),i}return h(e,t),Object.defineProperty(e.prototype,"constant",{get:function(){return this._constant},set:function(t){t!==this._constant&&(this._constant=u.asNumber(t,!1),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(e<=0)){var i=t.prototype._getBindingValues.call(this,0),a=t.prototype._getBindingValues.call(this,1),n=t.prototype._getBindingValues.call(this,3),l=this._getXValues();this._yvals=s(i,a,n,this.period,this.constant),this._xvals=l?l.slice(this.period-1):c._range(this.period-1,e-1)}},e}(v),t("CCI",b),x=function(t){function e(e){var i=t.call(this)||this;return i.period=14,i.initialize(e),i}return h(e,t),e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(e<=0)){var i=t.prototype._getBindingValues.call(this,0),s=t.prototype._getBindingValues.call(this,1),n=t.prototype._getBindingValues.call(this,3),l=this._getXValues();this._yvals=a(i,s,n,this.period),this._xvals=l?l.slice(this.period-1):c._range(this.period-1,e-1)}},e}(v),t("WilliamsR",x),function(t){t[t.Simple=0]="Simple",t[t.Exponential=1]="Exponential"}(P||(P={})),t("MovingAverageType",P),w=function(t){function e(e){var i=t.call(this)||this;return i._period=20,i._type=P.Simple,i._size=.025,i.rendering.addHandler(i._rendering,i),i.initialize(e),i}return h(e,t),Object.defineProperty(e.prototype,"period",{get:function(){return this._period},set:function(t){t!==this._period&&(this._period=u.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(t){t!==this._type&&(this._type=u.asEnum(t,P,!1),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},set:function(t){t!==this._size&&(this._size=u.asNumber(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype.getDataRect=function(e,i){if(i)return i;var s=null;if(t.prototype._getLength.call(this)<=0)return s;this._shouldCalculate()&&(this._init(),this._calculate());var a=this._upperYVals.concat(this._lowerYVals),n=c._minimum(this._xVals),l=c._maximum(this._xVals),r=c._minimum(a),o=c._maximum(a);return _._DataInfo.isValid(n)&&_._DataInfo.isValid(l)&&_._DataInfo.isValid(r)&&_._DataInfo.isValid(o)&&(s=new u.Rect(n,r,l-n,o-r)),s},e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this._upperYVals=null,this._lowerYVals=null,this._xVals=null},e.prototype._init=function(){t.prototype._init.call(this),this._upperYVals=[],this._lowerYVals=[],this._xVals=[]},e.prototype._shouldCalculate=function(){return!this._upperYVals||!this._lowerYVals||!this._xVals},e.prototype._calculate=function(){var e=this;if(!(t.prototype._getLength.call(this)<=0)){var i,s=t.prototype.getValues.call(this,0),a=this._getXValues();switch(this.type){case P.Exponential:i=c._ema(s,this.period);break;case P.Simple:default:i=c._sma(s,this.period)}this._xVals=a?a.slice(this.period-1):c._range(this.period-1,t.prototype._getLength.call(this)-1),this._upperYVals=i.map(function(t){return t+t*e.size}),this._lowerYVals=i.map(function(t){return t-t*e.size})}},e.prototype._rendering=function(e,i){if(i.cancel=!0,!(t.prototype._getLength.call(this)<=0)){this._shouldCalculate()&&(this._init(),this._calculate());var s=this.chart.series.indexOf(this),a=i.engine,n=this._getAxisX(),l=this._getAxisY(),r=c._minimum(this._upperYVals.length,this._lowerYVals.length,this._xVals.length),o=_._BasePlotter.cloneStyle(this.style,["fill"]),h=this._getSymbolStroke(s),p=this.chart._plotrectId;if(r&&!(r<=0)){a.stroke=h,a.strokeWidth=2;for(var d,g,f,y=[],m=[],v=[],V=this._getLength(),b=0;b<r;b++)f=V-r+b,y.push(n.convert(this._xVals[b])),m.push(l.convert(this._upperYVals[b])),d=this._getDataPoint(this._xVals[b],this._upperYVals[b],s,f,n,l),(g=new _._CircleArea(new u.Point(y[b],m[b]),.5*a.strokeWidth)).tag=d,this._hitTester.add(g,s),v.push(l.convert(this._lowerYVals[b])),d=this._getDataPoint(this._xVals[b],this._lowerYVals[b],s,f,n,l),(g=new _._CircleArea(new u.Point(y[b],v[b]),.5*a.strokeWidth)).tag=d,this._hitTester.add(g,s);this._hitTester.add(new _._LinesArea(y,m),s),this._hitTester.add(new _._LinesArea(y,v),s),a.drawLines(y,m,null,o,p),a.drawLines(y,v,null,o,p)}}},e.prototype.getCalculatedValues=function(e){e=u.asString(e,!1);var i=[],s=0;if(t.prototype._getLength.call(this)<=0)return i;switch(this._shouldCalculate()&&(this._init(),this._calculate()),e){case"upperEnvelope":for(;s<this._upperYVals.length;s++)i.push({x:this._xVals[s],y:this._upperYVals[s]});break;case"lowerEnvelope":for(;s<this._lowerYVals.length;s++)i.push({x:this._xVals[s],y:this._lowerYVals[s]})}return i},e}(m),t("Envelopes",w),k=function(t){function e(e){var i=t.call(this)||this;return i._period=20,i._multiplier=2,i.rendering.addHandler(i._rendering,i),i.initialize(e),i}return h(e,t),Object.defineProperty(e.prototype,"period",{get:function(){return this._period},set:function(t){t!==this._period&&(this._period=u.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"multiplier",{get:function(){return this._multiplier},set:function(t){t!==this._multiplier&&(this._multiplier=u.asNumber(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype.getDataRect=function(e,i){if(i)return i;if(t.prototype._getLength.call(this)<=0)return null;this._shouldCalculate()&&(this._init(),this._calculate());var s=this._upperYVals.concat(this._lowerYVals),a=c._minimum(this._xVals),n=c._maximum(this._xVals),l=c._minimum(s),r=c._maximum(s);return _._DataInfo.isValid(a)&&_._DataInfo.isValid(n)&&_._DataInfo.isValid(l)&&_._DataInfo.isValid(r)?new u.Rect(a,l,n-a,r-l):null},e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this._upperYVals=null,this._middleYVals=null,this._lowerYVals=null,this._xVals=null},e.prototype._shouldCalculate=function(){return!(this._upperYVals&&this._middleYVals&&this._lowerYVals&&this._xVals)},e.prototype._init=function(){t.prototype._init.call(this),this._upperYVals=[],this._middleYVals=[],this._lowerYVals=[],this._xVals=[]},e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(e<=0)){var i=t.prototype.getValues.call(this,0),s=this._getXValues(),a=n(i,this.period,this.multiplier);this._upperYVals=a.uppers,this._middleYVals=a.middles,this._lowerYVals=a.lowers,this._xVals=s?s.slice(this.period-1):c._range(this.period-1,e-1)}},e.prototype._rendering=function(e,i){if(i.cancel=!0,!(t.prototype._getLength.call(this)<=0)){this._shouldCalculate()&&(this._init(),this._calculate());var s=this.chart.series.indexOf(this),a=i.engine,n=this._getAxisX(),l=this._getAxisY(),r=c._minimum(this._upperYVals.length,this._middleYVals.length,this._lowerYVals.length,this._xVals.length),o=_._BasePlotter.cloneStyle(this.style,["fill"]),h=this._getSymbolStroke(s),p=this.chart._plotrectId;if(r&&!(r<=0)){a.stroke=h,a.strokeWidth=2;for(var d,g,f,y=[],m=[],v=[],V=[],b=this._getLength(),x=0;x<r;x++)f=b-r+x,y.push(n.convert(this._xVals[x])),m.push(l.convert(this._upperYVals[x])),d=this._getDataPoint(this._xVals[x],this._upperYVals[x],s,f,n,l),(g=new _._CircleArea(new u.Point(y[x],m[x]),.5*a.strokeWidth)).tag=d,this._hitTester.add(g,s),v.push(l.convert(this._middleYVals[x])),d=this._getDataPoint(this._xVals[x],this._middleYVals[x],s,f,n,l),(g=new _._CircleArea(new u.Point(y[x],v[x]),.5*a.strokeWidth)).tag=d,this._hitTester.add(g,s),V.push(l.convert(this._lowerYVals[x])),d=this._getDataPoint(this._xVals[x],this._lowerYVals[x],s,f,n,l),(g=new _._CircleArea(new u.Point(y[x],V[x]),.5*a.strokeWidth)).tag=d,this._hitTester.add(g,s);this._hitTester.add(new _._LinesArea(y,m),s),this._hitTester.add(new _._LinesArea(y,v),s),this._hitTester.add(new _._LinesArea(y,V),s),a.drawLines(y,m,null,o,p),a.drawLines(y,v,null,o,p),a.drawLines(y,V,null,o,p)}}},e.prototype.getCalculatedValues=function(e){e=u.asString(e,!1);var i=[],s=0;if(t.prototype._getLength.call(this)<=0)return i;switch(this._shouldCalculate()&&(this._init(),this._calculate()),e){case"upperBand":for(;s<this._upperYVals.length;s++)i.push({x:this._xVals[s],y:this._upperYVals[s]});break;case"middleBand":for(;s<this._middleYVals.length;s++)i.push({x:this._xVals[s],y:this._middleYVals[s]});break;case"lowerBand":for(;s<this._lowerYVals.length;s++)i.push({x:this._xVals[s],y:this._lowerYVals[s]})}return i},e}(m),t("BollingerBands",k),L=function(t){function e(e){var i=t.call(this)||this;return i.period=14,i.initialize(e),i}return h(e,t),e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(e<=0)){var i=t.prototype._getBindingValues.call(this,0),s=this._getXValues();this._yvals=l(i,this.period),this._xvals=s?s.slice(this.period):c._range(this.period,e)}},e}(v),t("RSI",L),X=function(t){function e(e){var i=t.call(this,e)||this;return i._fastPeriod=12,i._slowPeriod=26,i._smoothingPeriod=9,i}return h(e,t),Object.defineProperty(e.prototype,"fastPeriod",{get:function(){return this._fastPeriod},set:function(t){t!==this._fastPeriod&&(this._fastPeriod=u.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"slowPeriod",{get:function(){return this._slowPeriod},set:function(t){t!==this._slowPeriod&&(this._slowPeriod=u.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"smoothingPeriod",{get:function(){return this._smoothingPeriod},set:function(t){t!==this._smoothingPeriod&&(this._smoothingPeriod=u.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this._macdVals=null,this._macdXVals=null,this._signalVals=null,this._signalXVals=null,this._histogramVals=null,this._histogramXVals=null},e.prototype._shouldCalculate=function(){return!(this._macdVals&&this._macdXVals&&this._signalVals&&this._signalXVals&&this._histogramVals&&this._histogramXVals)},e.prototype._init=function(){t.prototype._init.call(this),this._macdVals=[],this._macdXVals=[],this._signalVals=[],this._signalXVals=[],this._histogramVals=[],this._histogramXVals=[]},e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(e<=0)){var i=t.prototype.getValues.call(this,0),s=this._getXValues(),a=r(i,this.fastPeriod,this.slowPeriod,this.smoothingPeriod);this._macdVals=a.macds,this._signalVals=a.signals,this._histogramVals=a.histograms,this._macdXVals=s?s.slice(e-this._macdVals.length,e):c._range(e-this._macdVals.length,e-1),this._signalXVals=s?s.slice(e-this._signalVals.length,e):c._range(e-this._signalVals.length,e-1),this._histogramXVals=s?s.slice(e-this._histogramVals.length,e):c._range(e-this._histogramVals.length,e-1)}},e}(m),t("MacdBase",X),M=function(t){function e(e){var i=t.call(this)||this;return i._seriesCount=2,i.rendering.addHandler(i._rendering,i),i.initialize(e),i}return h(e,t),Object.defineProperty(e.prototype,"styles",{get:function(){return this._styles},set:function(t){t!==this._styles&&(this._styles=t,this._invalidate())},enumerable:!0,configurable:!0}),e.prototype.getDataRect=function(e,i){if(i)return i;var s=null;if(t.prototype._getLength.call(this)<=0)return s;this._shouldCalculate()&&(this._init(),this._calculate());var a=[],n=[];n.push.apply(n,this._macdXVals),n.push.apply(n,this._signalXVals),a.push.apply(a,this._macdVals),a.push.apply(a,this._signalVals);var l=c._minimum(n),r=c._maximum(n),o=c._minimum(a),h=c._maximum(a);return _._DataInfo.isValid(l)&&_._DataInfo.isValid(r)&&_._DataInfo.isValid(o)&&_._DataInfo.isValid(h)&&(s=new u.Rect(l,o,r-l,h-o)),s},e.prototype._rendering=function(e,i){if(i.cancel=!0,!(t.prototype._getLength.call(this)<=0)){this._shouldCalculate()&&(this._init(),this._calculate());var s=this.chart.series.indexOf(this),a=i.engine,n=this._getAxisX(),l=this._getAxisY(),r=_._BasePlotter.cloneStyle(this.style,["fill"]),o=this._getSymbolStroke(s),h=this.chart._plotrectId,c=null,p=o,d=2,g=null,f=o,y=2;this.styles&&u.isObject(this.styles)&&(this.styles.macdLine&&u.isObject(this.styles.macdLine)&&(p=(c=_._BasePlotter.cloneStyle(this.styles.macdLine,["fill"])).stroke?c.stroke:o,d=c.strokeWidth?c.strokeWidth:2),this.styles.signalLine&&u.isObject(this.styles.signalLine)&&(f=(g=_._BasePlotter.cloneStyle(this.styles.signalLine,["fill"])).stroke?g.stroke:o,y=g.strokeWidth?g.strokeWidth:2));var m,v,V,b,x=[],P=[],w=[],k=[],L=this._getLength();for(V=0;V<this._macdVals.length;V++)b=L-this._macdVals.length+V,P.push(n.convert(this._macdXVals[V])),x.push(l.convert(this._macdVals[V])),(m=this._getDataPoint(this._macdXVals[V],this._macdVals[V],s,b,n,l)).name=this._getName(0),(v=new _._CircleArea(new u.Point(P[V],x[V]),.5*a.strokeWidth)).tag=m,this._hitTester.add(v,s);for(this._hitTester.add(new _._LinesArea(P,x),s),a.stroke=p,a.strokeWidth=d,a.drawLines(P,x,null,r,h),V=0;V<this._signalVals.length;V++)b=L-this._signalVals.length+V,k.push(n.convert(this._signalXVals[V])),w.push(l.convert(this._signalVals[V])),(m=this._getDataPoint(this._signalXVals[V],this._signalVals[V],s,b,n,l)).name=this._getName(1),(v=new _._CircleArea(new u.Point(k[V],w[V]),.5*a.strokeWidth)).tag=m,this._hitTester.add(v,s);this._hitTester.add(new _._LinesArea(k,w),s),a.stroke=f,a.strokeWidth=y,a.drawLines(k,w,null,r,h)}},e.prototype.getCalculatedValues=function(e){e=u.asString(e,!1);var i=[],s=0;if(t.prototype._getLength.call(this)<=0)return i;switch(this._shouldCalculate()&&(this._init(),this._calculate()),e){case"macdLine":for(;s<this._macdVals.length;s++)i.push({x:this._macdXVals[s],y:this._macdVals[s]});break;case"signalLine":for(;s<this._signalVals.length;s++)i.push({x:this._signalXVals[s],y:this._signalVals[s]})}return i},e}(X),t("Macd",M),I=function(t){function e(e){return t.call(this,e)||this}return h(e,t),e.prototype.getValues=function(e){var i=null;return t.prototype._getLength.call(this)<=0?i:(this._shouldCalculate()&&(this._init(),this._calculate()),0===e?i=this._histogramVals:1===e&&(i=this._histogramXVals),i)},e.prototype.getDataRect=function(e,i){if(i)return i;var s=null;if(t.prototype._getLength.call(this)<=0)return s;this._shouldCalculate()&&(this._init(),this._calculate());var a=c._minimum(this._histogramXVals),n=c._maximum(this._histogramXVals),l=c._minimum(this._histogramVals),r=c._maximum(this._histogramVals);return _._DataInfo.isValid(a)&&_._DataInfo.isValid(n)&&_._DataInfo.isValid(l)&&_._DataInfo.isValid(r)&&(s=new u.Rect(a,l,n-a,r-l)),s},e.prototype._getChartType=function(){return _.ChartType.Column},e.prototype._getItem=function(e){return e=t.prototype._getLength.call(this)-c._minimum(this._histogramVals.length,this._histogramXVals.length)+e,t.prototype._getItem.call(this,e)},e}(X),t("MacdHistogram",I),B=function(t){function e(e){var i=t.call(this)||this;return i._kPeriod=14,i._dPeriod=3,i._smoothingPeriod=1,i._seriesCount=2,i.rendering.addHandler(i._rendering,i),i.initialize(e),i}return h(e,t),Object.defineProperty(e.prototype,"kPeriod",{get:function(){return this._kPeriod},set:function(t){t!==this._kPeriod&&(this._kPeriod=u.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dPeriod",{get:function(){return this._dPeriod},set:function(t){t!==this._dPeriod&&(this._dPeriod=u.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"smoothingPeriod",{get:function(){return this._smoothingPeriod},set:function(t){t!==this._smoothingPeriod&&(this._smoothingPeriod=u.asInt(t,!1,!0),this._clearValues(),this._invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"styles",{get:function(){return this._styles},set:function(t){t!==this._styles&&(this._styles=t,this._invalidate())},enumerable:!0,configurable:!0}),e.prototype.getDataRect=function(e,i){if(i)return i;var s=null;if(t.prototype._getLength.call(this)<=0)return s;this._shouldCalculate()&&(this._init(),this._calculate());var a=this._kVals.concat(this._dVals),n=this._kXVals.concat(this._dXVals),l=c._minimum(n),r=c._maximum(n),o=c._minimum(a),h=c._maximum(a);return _._DataInfo.isValid(l)&&_._DataInfo.isValid(r)&&_._DataInfo.isValid(o)&&_._DataInfo.isValid(h)&&(s=new u.Rect(l,o,r-l,h-o)),s},e.prototype._clearValues=function(){t.prototype._clearValues.call(this),this._kVals=null,this._kXVals=null,this._dVals=null,this._dXVals=null},e.prototype._shouldCalculate=function(){return!(this._kVals&&this._kXVals&&this._dVals&&this._dXVals)},e.prototype._init=function(){t.prototype._init.call(this),this._kVals=[],this._kXVals=[],this._dVals=[],this._dXVals=[]},e.prototype._calculate=function(){var e=t.prototype._getLength.call(this);if(!(t.prototype._getLength.call(this)<=0)){var i=t.prototype._getBindingValues.call(this,0),s=t.prototype._getBindingValues.call(this,1),a=t.prototype._getBindingValues.call(this,3),n=this._getXValues(),l=o(i,s,a,this.kPeriod,this.dPeriod,this.smoothingPeriod);this._kVals=l.ks,this._dVals=l.ds,this._kXVals=n?n.slice(this.kPeriod-1):c._range(this.kPeriod-1,e-1),this.smoothingPeriod&&this.smoothingPeriod>1&&(this._kXVals=this._kXVals.slice(this._kXVals.length-this._kVals.length,this._kXVals.length)),this._dXVals=this._kXVals.slice(this._kXVals.length-this._dVals.length,this._kXVals.length)}},e.prototype._rendering=function(e,i){if(i.cancel=!0,!(t.prototype._getLength.call(this)<=0)){this._shouldCalculate()&&(this._init(),this._calculate());var s=this.chart.series.indexOf(this),a=i.engine,n=this._getAxisX(),l=this._getAxisY(),r=_._BasePlotter.cloneStyle(this.style,["fill"]),o=this._getSymbolStroke(s),h=this.chart._plotrectId,c=null,p=o,d=2,g=null,f=o,y=2;this.styles&&u.isObject(this.styles)&&(this.styles.kLine&&u.isObject(this.styles.kLine)&&(p=(c=_._BasePlotter.cloneStyle(this.styles.kLine,["fill"])).stroke?c.stroke:o,d=c.strokeWidth?c.strokeWidth:2),this.styles.dLine&&u.isObject(this.styles.dLine)&&(f=(g=_._BasePlotter.cloneStyle(this.styles.dLine,["fill"])).stroke?g.stroke:o,y=g.strokeWidth?g.strokeWidth:2));var m,v,V,b,x=[],P=[],w=[],k=[],L=this._getLength();for(V=0;V<this._kVals.length;V++)b=L-this._kVals.length+V,P.push(n.convert(this._kXVals[V])),x.push(l.convert(this._kVals[V])),(m=this._getDataPoint(this._kXVals[V],this._kVals[V],s,b,n,l)).name=this._getName(0),(v=new _._CircleArea(new u.Point(P[V],x[V]),.5*a.strokeWidth)).tag=m,this._hitTester.add(v,s);for(this._hitTester.add(new _._LinesArea(P,x),s),a.stroke=p,a.strokeWidth=d,a.drawLines(P,x,null,r,h),V=0;V<this._dVals.length;V++)b=L-this._dVals.length+V,k.push(n.convert(this._dXVals[V])),w.push(l.convert(this._dVals[V])),(m=this._getDataPoint(this._dXVals[V],this._dVals[V],s,b,n,l)).name=this._getName(1),(v=new _._CircleArea(new u.Point(k[V],w[V]),.5*a.strokeWidth)).tag=m,this._hitTester.add(v,s);this._hitTester.add(new _._LinesArea(k,w),s),a.stroke=f,a.strokeWidth=y,a.drawLines(k,w,null,r,h)}},e.prototype.getCalculatedValues=function(e){e=u.asString(e,!1);var i=[],s=0;if(t.prototype._getLength.call(this)<=0)return i;switch(this._shouldCalculate()&&(this._init(),this._calculate()),e){case"kLine":for(;s<this._kVals.length;s++)i.push({x:this._kXVals[s],y:this._kVals[s]});break;case"dLine":for(;s<this._dVals.length;s++)i.push({x:this._dXVals[s],y:this._dVals[s]})}return i},e}(m),t("Stochastic",B)}}});