/*
    *
    * Wijmo Library 5.20182.500
    * 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/
    *
    */
var __extends=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 n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define(["require","exports","wijmo/wijmo","wijmo/wijmo.chart","wijmo/wijmo.chart.finance"],function(t,e,i,n,a){"use strict";function s(t){return i.asNumber(t,!0,!1),t>0?Math.floor(t):Math.ceil(t)}function r(t){return arguments.length>1&&(t=Array.prototype.slice.call(arguments)),i.asArray(t,!1),t.reduce(function(t,e){return t+i.asNumber(e)},0)}function o(t){return arguments.length>1&&(t=Array.prototype.slice.call(arguments)),i.asArray(t,!1),r(t)/t.length}function l(t){arguments.length>1&&(t=Array.prototype.slice.call(arguments)),i.asArray(t,!1);var e=o(t);return o(t.map(function(t){return Math.pow(t-e,2)}))}function h(t,e,n,a){void 0===a&&(a=14),i.asArray(t,!1),i.asArray(e,!1),i.asArray(n,!1),i.asInt(a,!1,!0);var s=u(t,e,n,a),r=Math.min(t.length,e.length,n.length,s.length),l=[];i.assert(r>a&&a>1,"Average True Range period must be an integer less than the length of the data and greater than one.");for(var h=0;h<r;h++)i.asNumber(t[h],!1),i.asNumber(e[h],!1),i.asNumber(n[h],!1),i.asNumber(s[h],!1),h+1===a?l.push(o(s.slice(0,a))):h+1>a&&l.push(((a-1)*l[l.length-1]+s[h])/a);return l}function u(t,e,n,a){void 0===a&&(a=14),i.asArray(t,!1),i.asArray(e,!1),i.asArray(n,!1),i.asInt(a,!1,!0);var s=Math.min(t.length,e.length,n.length),r=[];i.assert(s>a&&a>1,"True Range period must be an integer less than the length of the data and greater than one.");for(var o=0;o<s;o++)i.asNumber(t[o],!1),i.asNumber(e[o],!1),i.asNumber(n[o],!1),0===o?r.push(t[o]-e[o]):r.push(Math.max(t[o]-e[o],Math.abs(t[o]-n[o-1]),Math.abs(e[o]-n[o-1])));return r}function c(t,e){i.asArray(t,!1),i.asNumber(e,!1,!0),i.assert(t.length>e&&e>1,"Simple Moving Average period must be an integer less than the length of the data and greater than one.");for(var n=[],a=e;a<=t.length;a++)n.push(o(t.slice(a-e,a)));return n}Object.defineProperty(e,"__esModule",{value:!0});var _=a||e;window.wijmo=window.wijmo||{},window.wijmo.chart=window.wijmo.chart||{},window.wijmo.chart.finance=_,e._trunc=s,e._sum=r,e._average=o,e._minimum=function(t){return arguments.length>1&&(t=Array.prototype.slice.call(arguments)),i.asArray(t,!1),Math.min.apply(null,t)},e._maximum=function(t){return arguments.length>1&&(t=Array.prototype.slice.call(arguments)),i.asArray(t,!1),Math.max.apply(null,t)},e._variance=l,e._stdDeviation=function(t){return arguments.length>1&&(t=Array.prototype.slice.call(arguments)),i.asArray(t,!1),Math.sqrt(l(t))},e._avgTrueRng=h,e._trueRng=u,e._sma=c,e._ema=function(t,e){i.asArray(t,!1),i.asNumber(e,!1,!0),i.assert(t.length>e&&e>1,"Exponential Moving Average period must be an integer less than the length of the data and greater than one.");var n=[],a=2/(e+1),s=c(t,e);t=t.slice(e-1);for(var r=0;r<t.length;r++)0===r?n.push(s[0]):n.push((t[r]-n[r-1])*a+n[r-1]);return n},e._range=function(t,e,n){void 0===n&&(n=1),i.asNumber(t,!1),i.asNumber(e,!1),i.asNumber(n,!1),i.assert(t<e,"begin argument must be less than end argument.");for(var a=[],s=t;s<=e;s+=n)a.push(s);return a};var g;!function(t){t[t.Column=0]="Column",t[t.Scatter=1]="Scatter",t[t.Line=2]="Line",t[t.LineSymbols=3]="LineSymbols",t[t.Area=4]="Area",t[t.Candlestick=5]="Candlestick",t[t.HighLowOpenClose=6]="HighLowOpenClose",t[t.HeikinAshi=7]="HeikinAshi",t[t.LineBreak=8]="LineBreak",t[t.Renko=9]="Renko",t[t.Kagi=10]="Kagi",t[t.ColumnVolume=11]="ColumnVolume",t[t.EquiVolume=12]="EquiVolume",t[t.CandleVolume=13]="CandleVolume",t[t.ArmsCandleVolume=14]="ArmsCandleVolume",t[t.PointAndFigure=15]="PointAndFigure"}(g=e.FinancialChartType||(e.FinancialChartType={}));var p=function(t){function e(e,i){var n=t.call(this,e,null)||this;return n._chartType=g.Line,n.__heikinAshiPlotter=null,n.__lineBreakPlotter=null,n.__renkoPlotter=null,n.__kagiPlotter=null,n.__pfPlotter=null,n.initialize(i),n}return __extends(e,t),e.prototype._getProductInfo=function(){return"A78U,FinancialChart"},Object.defineProperty(e.prototype,"chartType",{get:function(){return this._chartType},set:function(t){(t=i.asEnum(t,g))!=this._chartType&&(this._chartType=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},set:function(t){t!=this._options&&(this._options=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_heikinAshiPlotter",{get:function(){return null===this.__heikinAshiPlotter&&(this.__heikinAshiPlotter=new b,this._initPlotter(this.__heikinAshiPlotter)),this.__heikinAshiPlotter},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_lineBreakPlotter",{get:function(){return null===this.__lineBreakPlotter&&(this.__lineBreakPlotter=new C,this._initPlotter(this.__lineBreakPlotter)),this.__lineBreakPlotter},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_renkoPlotter",{get:function(){return null===this.__renkoPlotter&&(this.__renkoPlotter=new A,this._initPlotter(this.__renkoPlotter)),this.__renkoPlotter},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_kagiPlotter",{get:function(){return null===this.__kagiPlotter&&(this.__kagiPlotter=new L,this._initPlotter(this.__kagiPlotter)),this.__kagiPlotter},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_pfPlotter",{get:function(){return null===this.__pfPlotter&&(this.__pfPlotter=new S,this._initPlotter(this.__pfPlotter)),this.__pfPlotter},enumerable:!0,configurable:!0}),e.prototype._getChartType=function(){var t=null;switch(this.chartType){case g.Area:t=n.ChartType.Area;break;case g.Line:case g.Kagi:case g.PointAndFigure:t=n.ChartType.Line;break;case g.Column:case g.ColumnVolume:t=n.ChartType.Column;break;case g.LineSymbols:t=n.ChartType.LineSymbols;break;case g.Scatter:t=n.ChartType.Scatter;break;case g.Candlestick:case g.Renko:case g.HeikinAshi:case g.LineBreak:case g.EquiVolume:case g.CandleVolume:case g.ArmsCandleVolume:t=n.ChartType.Candlestick;break;case g.HighLowOpenClose:t=n.ChartType.HighLowOpenClose}return t},e.prototype._getPlotter=function(e){var n=this.chartType,a=null;if(e){var s=e.chartType;s&&!i.isUndefined(s)&&s!=n&&(n=s,!0)}switch(n){case g.HeikinAshi:a=this._heikinAshiPlotter;break;case g.LineBreak:a=this._lineBreakPlotter;break;case g.Renko:a=this._renkoPlotter;break;case g.Kagi:a=this._kagiPlotter;break;case g.ColumnVolume:(a=t.prototype._getPlotter.call(this,e)).isVolume=!0,a.width=1;break;case g.EquiVolume:(a=t.prototype._getPlotter.call(this,e)).isEqui=!0,a.isCandle=!1,a.isArms=!1,a.isVolume=!0,a.symbolWidth="100%";break;case g.CandleVolume:(a=t.prototype._getPlotter.call(this,e)).isEqui=!1,a.isCandle=!0,a.isArms=!1,a.isVolume=!0,a.symbolWidth="100%";break;case g.ArmsCandleVolume:(a=t.prototype._getPlotter.call(this,e)).isEqui=!1,a.isCandle=!1,a.isArms=!0,a.isVolume=!0,a.symbolWidth="100%";break;case g.PointAndFigure:a=this._pfPlotter;break;default:a=t.prototype._getPlotter.call(this,e)}return a},e.prototype._createSeries=function(){return new d},e}(n.FlexChartCore);e.FinancialChart=p;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),Object.defineProperty(e.prototype,"chartType",{get:function(){return this._finChartType},set:function(t){(t=i.asEnum(t,g,!0))!=this._finChartType&&(this._finChartType=t,this._invalidate())},enumerable:!0,configurable:!0}),e.prototype._getChartType=function(){var t=null;switch(this.chartType){case g.Area:t=n.ChartType.Area;break;case g.Line:case g.Kagi:case g.PointAndFigure:t=n.ChartType.Line;break;case g.Column:case g.ColumnVolume:t=n.ChartType.Column;break;case g.LineSymbols:t=n.ChartType.LineSymbols;break;case g.Scatter:t=n.ChartType.Scatter;break;case g.Candlestick:case g.Renko:case g.HeikinAshi:case g.LineBreak:case g.EquiVolume:case g.CandleVolume:case g.ArmsCandleVolume:t=n.ChartType.Candlestick;break;case g.HighLowOpenClose:t=n.ChartType.HighLowOpenClose}return t},e.prototype.getDataRect=function(t,e){if(e)return e;var a=this.getValues(0),s=this.getValues(1)||(this.chart._xvals&&this.chart._xvals.length?this.chart._xvals:null),r=this._getBinding(0),o=this._getBinding(1),l=this._getBinding(2),h=this._getBinding(3),u=(this._plotter,this._getChartType()||this.chart._getChartType());if(u!==n.ChartType.HighLowOpenClose&&u!==n.ChartType.Candlestick||r===o)return null;if(a){for(var c=NaN,_=NaN,g=NaN,p=NaN,d=a.length,f=0;f<d;f++){var m=this._getItem(f),y=a[f];if(isFinite(y)&&[y,o?m[o]:null,l?m[l]:null,h?m[h]:null].forEach(function(t){n._DataInfo.isValid(t)&&null!==t&&((isNaN(_)||t<_)&&(_=t),(isNaN(p)||t>p)&&(p=t))}),s){var v=s[f];isFinite(v)&&(isNaN(c)?c=g=v:v<c?c=v:y>p&&(g=v))}}if(s||(c=0,g=d-1),!isNaN(_))return new i.Rect(c,_,g-c,p-_)}return null},e}(n.SeriesBase);e.FinancialSeries=d;var f=function(){function t(t,e,i,n){this.highs=t,this.lows=e,this.opens=i,this.closes=n}return t.prototype.calculate=function(){},t}();e._BaseCalculator=f;var m=function(t){function e(e,i,n,a){return t.call(this,e,i,n,a)||this}return __extends(e,t),e.prototype.calculate=function(){var t,e,i,n,a=Math.min(this.highs.length,this.lows.length,this.opens.length,this.closes.length),s=[];if(a<=0)return s;for(var r=0;r<a;r++)n=o(this.highs[r],this.lows[r],this.opens[r],this.closes[r]),0===r?(i=o(this.opens[r],this.closes[r]),t=this.highs[r],e=this.lows[r]):(i=o(s[r-1].open,s[r-1].close),t=Math.max(this.highs[r],i,n),e=Math.min(this.lows[r],i,n)),s.push({high:t,low:e,close:n,open:i,pointIndex:r,x:null});return s},e}(f);e._HeikinAshiCalculator=m;var y=function(t){function e(e,i,n,a,s,r,o,l){var h=t.call(this,e,i,n,a)||this;return h.xs=s,h.size=r,h.unit=o,h.fields=l,h}return __extends(e,t),e.prototype._getValues=function(){var t,e=[],i=Math.min(this.highs.length,this.lows.length,this.opens.length,this.closes.length);switch(this.fields){case V.High:e=this.highs;break;case V.Low:e=this.lows;break;case V.Open:e=this.opens;break;case V.HL2:for(t=0;t<i;t++)e.push(o(this.highs[t],this.lows[t]));break;case V.HLC3:for(t=0;t<i;t++)e.push(o(this.highs[t],this.lows[t],this.closes[t]));break;case V.HLOC4:for(t=0;t<i;t++)e.push(o(this.highs[t],this.lows[t],this.opens[t],this.closes[t]));break;case V.Close:default:e=this.closes}return e},e.prototype._getSize=function(){var t=this.unit===P.ATR?h(this.highs,this.lows,this.closes,this.size):null;return this.unit===P.ATR?t[t.length-1]:this.size},e}(f);e._BaseRangeCalculator=y;var v=function(t){function e(e,i,n,a,s,r){return t.call(this,e,i,n,a,s,r)||this}return __extends(e,t),e.prototype.calculate=function(){var t=null!==this.xs&&this.xs.length>0,e=this.closes.length,i=[],n=[[],[]];if(e<=0)return i;for(var a,s,r,o,l,h,u,c=[],_=1;_<e;_++){if(o=i.length,l=o-1,s=t?this.xs[_]:_,r=this.closes[_],-1===l){if((a=this.closes[0])===r)continue}else if(c=this._trendExists(n)||1===this.size?n[0].slice(-this.size).concat(n[1].slice(-this.size)):n[0].slice(1-this.size).concat(n[1].slice(1-this.size)),h=Math.max.apply(null,c),u=Math.min.apply(null,c),r>h)a=Math.max(n[0][l],n[1][l]);else{if(!(r<u))continue;a=Math.min(n[0][l],n[1][l])}n[0].push(a),n[1].push(r),i.push({high:Math.max(a,r),low:Math.min(a,r),open:a,close:r,x:s,pointIndex:_})}return i},e.prototype._trendExists=function(t){if(t[1].length<this.size)return!1;var e,i=!1,n=t[1].slice(-this.size);for(e=1;e<this.size&&(i=n[e]>n[e-1]);e++);if(!i)for(e=1;e<this.size&&(i=n[e]<n[e-1]);e++);return i},e}(y);e._LineBreakCalculator=v;var x=function(t){function e(e,i,n,a,s,r,o,l){return t.call(this,e,i,n,a,s,r,o,l)||this}return __extends(e,t),e.prototype.calculate=function(){var t=this._getSize(),e=Math.min(this.highs.length,this.lows.length,this.opens.length,this.closes.length),i=this._getValues(),n=null!==this.xs&&this.xs.length>0,a=[],s=[[],[]];if(e<=0)return a;for(var r,o,l,h,u,c,_,g,p,d,f=1;f<e;f++){if(h=a.length,u=h-1,o=n?this.xs[f]:f,d=f,p=!1,this.fields===V.HighLow)if(-1===u)if(this.highs[f]>this.highs[0])l=this.highs[f];else{if(!(this.lows[f]<this.lows[0]))continue;l=this.lows[f]}else if((g=s[1][u]-s[0][u])>0)if(this.highs[f]>s[1][u])l=this.highs[f];else{if(!(this.lows[f]<s[1][u]))continue;l=this.lows[f]}else if(this.lows[f]<s[1][u])l=this.lows[f];else{if(!(this.highs[f]>s[1][u]))continue;l=this.highs[f]}else l=i[f];if(this.unit===P.Percentage&&(t=l*this.size),-1===u){if(o=n?this.xs[0]:0,d=0,r=this.fields===V.HighLow?null==this.highs[0]?this.highs[this.highs.length-1]:this.highs[0]:null==i[0]?i[i.length-1]:i[0],(g=Math.abs(r-l)||0)<t)continue}else if(g=s[1][u]-s[0][u],_=Math.max(s[0][u],s[1][u]),c=Math.min(s[0][u],s[1][u]),g>0)if(l>_)p=!0;else{if(!((g=_-l)>=t))continue;r=_}else if(l<c)p=!0;else{if(!((g=l-c)>=t))continue;r=c}p?(s[1][u]=l,a[u].close=l,a[u].high=Math.max(a[u].open,a[u].close),a[u].low=Math.min(a[u].open,a[u].close)):(s[0].push(r),s[1].push(l),a.push({high:Math.max(r,l),low:Math.min(r,l),open:r,close:l,x:o,pointIndex:d}))}return a},e}(y);e._KagiCalculator=x;var w=function(t){function e(e,i,n,a,s,r,o,l,h){void 0===h&&(h=!1);var u=t.call(this,e,i,n,a,s,r,o,l)||this;return u.rounding=h,u}return __extends(e,t),e.prototype.calculate=function(){var t=this._getSize(),e=Math.min(this.highs.length,this.lows.length,this.opens.length,this.closes.length),i=null!==this.xs&&this.xs.length>0,n=this._getValues(),a=[],r=[[],[]];if(e<=0)return a;for(var o,l,h,u,c,_,g,p,d=1;d<e;d++){if(u=a.length,c=u-1,l=i?this.xs[d]:d,this.fields===V.HighLow)if(-1===c)if(this.highs[d]-this.highs[0]>t)o=this.highs[0],h=this.highs[d];else{if(!(this.lows[0]-this.lows[d]>t))continue;o=this.lows[0],h=this.lows[d]}else if(_=Math.min(r[0][c],r[1][c]),g=Math.max(r[0][c],r[1][c]),this.highs[d]-g>t)o=g,h=this.highs[d];else{if(!(_-this.lows[d]>t))continue;o=_,h=this.lows[d]}else if(h=n[d],-1===c)o=n[0];else if(_=Math.min(r[0][c],r[1][c]),g=Math.max(r[0][c],r[1][c]),h>g)o=g;else{if(!(h<_))continue;o=_}if(p=h-o,!(Math.abs(p)<t)){p=s(p/t);for(var f=0;f<Math.abs(p);f++){var m={};this.rounding&&(o=this._round(o,t)),r[0].push(o),m.open=o,o=p>0?o+t:o-t,r[1].push(o),m.close=o,m.x=l,m.pointIndex=d,m.high=Math.max(m.open,m.close),m.low=Math.min(m.open,m.close),a.push(m)}}}return a},e.prototype._round=function(t,e){return Math.round(t/e)*e},e}(y);e._RenkoCalculator=w;var b=function(t){function e(){var e=t.call(this)||this;return e._symFactor=.7,e.clear(),e}return __extends(e,t),e.prototype.clear=function(){t.prototype.clear.call(this),this._haValues=null,this._calculator=null},e.prototype.plotSeries=function(t,e,a,s,r,o,l){var h=this;this._calculate(s);var u=i.asType(s,n.SeriesBase),c=this.chart.series.indexOf(s),_=s.getValues(1),g=this._symFactor,p=this._haValues.length,d=!0;if(_){var f=this.dataInfo.getDeltaX();f>0&&(g*=f)}else _=this.dataInfo.getXVals();_?p=Math.min(p,_.length):(d=!1,_=new Array(p));var m=this._DEFAULT_WIDTH,y=u._getSymbolFill(c),v=u._getAltSymbolFill(c)||"transparent",x=u._getSymbolStroke(c),w=u._getAltSymbolStroke(c)||x,b=g,k=s.getDataType(1)||s.chart._xDataType;t.strokeWidth=m;for(var V,P,C,A,L,M,S,T,B=e.actualMin,D=e.actualMax,F=0,O=0;O<p;O++)if(C=d?_[O]:O,n._DataInfo.isValid(C)&&B<=C&&C<=D){if(L=this._haValues[O].high,M=this._haValues[O].low,S=this._haValues[O].open,T=this._haValues[O].close,V=S<T?v:y,P=S<T?w:x,t.fill=V,t.stroke=P,t.startGroup(),A=this._getDataPoint(c,O,C,s),this.chart.itemFormatter){var H=new n.HitTestInfo(this.chart,new i.Point(e.convert(C),a.convert(L)),n.ChartElement.SeriesSymbol);H._setData(u,O),H._setDataPoint(A),this.chart.itemFormatter(t,H,function(){h._drawSymbol(t,e,a,c,O,V,b,C,L,M,S,T,A,k)})}else this._drawSymbol(t,e,a,c,O,V,b,C,L,M,S,T,A,k);t.endGroup(),s._setPointIndex(O,F),F++}},e.prototype._drawSymbol=function(t,e,a,s,r,o,l,h,u,c,_,g,p,d){var f,m=null,y=null,v=null,x=null,w=d===i.DataType.Date?432e5:.5;if(v=e.convert(h-w*l),x=e.convert(h+w*l),v>x){var b=v;v=x,x=b}h=e.convert(h),n._DataInfo.isValid(_)&&n._DataInfo.isValid(g)&&(_=a.convert(_),g=a.convert(g),y=(m=Math.min(_,g))+Math.abs(_-g),t.drawRect(v,m,x-v,y-m),(f=new n._RectArea(new i.Rect(v,m,x-v,y-m))).tag=p,this.hitTester.add(f,s)),n._DataInfo.isValid(u)&&(u=a.convert(u),null!==m&&t.drawLine(h,m,h,u)),n._DataInfo.isValid(c)&&(c=a.convert(c),null!==y&&t.drawLine(h,y,h,c))},e.prototype._getDataPoint=function(t,e,i,a){var s=new n._DataPoint(t,e,i,this._haValues[e].high),r=a._getItem(e),o=a._getBinding(0),l=a._getBinding(1),h=a._getBinding(2),u=a._getBinding(3),c=a._getAxisY();return null!=r&&(s.item=n._BasePlotter.cloneStyle(r,[]),s.item[o]=this._haValues[e].high,s.item[l]=this._haValues[e].low,s.item[h]=this._haValues[e].open,s.item[u]=this._haValues[e].close),s.y=this._haValues[e].high,s.yfmt=c._formatValue(this._haValues[e].high),s},e.prototype._calculate=function(t){var e=t._getBindingValues(0),n=t._getBindingValues(1),a=t._getBindingValues(2),s=t._getBindingValues(3);this._calculator=new m(e,n,a,s),this._haValues=this._calculator.calculate(),(null===this._haValues||i.isUndefined(this._haValues))&&this._init()},e.prototype._init=function(){this._haValues=[]},e}(n._FinancePlotter);e._HeikinAshiPlotter=b;var k=function(t){function e(){var e=t.call(this)||this;return e._symFactor=.7,e.clear(),e}return __extends(e,t),e.prototype.clear=function(){t.prototype.clear.call(this),this._rangeValues=null,this._rangeXLabels=null,this._calculator=null},e.prototype.unload=function(){t.prototype.unload.call(this);for(var e,i,n=0;n<this.chart.series.length;n++)(e=this.chart.series[n])&&(i=e._getAxisX())&&i.itemsSource&&(i.itemsSource=null)},e.prototype.adjustLimits=function(t,e){var n,a,s,r=0,o=0,l=0,h=0,u=this.chart._xDataType===i.DataType.Date?.5:0;i.assert(this.chart.series.length<=1,"Current FinancialChartType only supports a single series");for(var c=0;c<this.chart.series.length;c++)n=this.chart.series[c],this._calculate(n),this._rangeValues.length<=0||this._rangeXLabels.length<=0||((a=this._rangeValues.map(function(t){return t.open})).push.apply(a,this._rangeValues.map(function(t){return t.close})),s=this._rangeXLabels.map(function(t){return t.value}),l=Math.min.apply(null,a),h=Math.max.apply(null,a),r=Math.min.apply(null,s),o=Math.max.apply(null,s),n._getAxisX().itemsSource=this._rangeXLabels);return r-=u,new i.Rect(r,l,o-r+u,h-l)},e.prototype.plotSeries=function(t,e,a,s,r,o,l){var h=this;this._calculate(s);var u=this.chart.series.indexOf(s),c=this._rangeValues.length,_=e.actualMin,g=e.actualMax,p=this._DEFAULT_WIDTH,d=this._symFactor,f=s._getSymbolFill(u),m=s._getAltSymbolFill(u)||"transparent",y=s._getSymbolStroke(u),v=s._getAltSymbolStroke(u)||y;t.strokeWidth=p;for(var x,w,b,k,V=0,P=0;P<c;P++)if(x=P,n._DataInfo.isValid(x)&&_<=x&&x<=g){if(w=this._rangeValues[P].open,b=this._rangeValues[P].close,t.fill=w>b?f:m,t.stroke=w>b?y:v,k=this._getDataPoint(u,P,s,Math.max(w,b)),t.startGroup(),this.chart.itemFormatter){var C=new n.HitTestInfo(this.chart,new i.Point(e.convert(x),a.convert(b)),n.ChartElement.SeriesSymbol);C._setData(s,P),C._setDataPoint(k),this.chart.itemFormatter(t,C,function(){h._drawSymbol(t,e,a,u,V,d,x,w,b,k)})}else this._drawSymbol(t,e,a,u,V,d,x,w,b,k);t.endGroup(),s._setPointIndex(P,V),V++}},e.prototype._drawSymbol=function(t,e,a,s,r,o,l,h,u,c){var _,g,p,d,f;if(p=e.convert(l-.5*o),d=e.convert(l+.5*o),p>d){var m=p;p=d,d=m}n._DataInfo.isValid(h)&&n._DataInfo.isValid(u)&&(h=a.convert(h),u=a.convert(u),g=(_=Math.min(h,u))+Math.abs(h-u),t.drawRect(p,_,d-p,g-_),(f=new n._RectArea(new i.Rect(p,_,d-p,g-_))).tag=c,this.hitTester.add(f,s))},e.prototype._getDataPoint=function(t,e,i,a){var s=e,r=new n._DataPoint(t,e,s,a),o=i._getItem(this._rangeValues[e].pointIndex),l=i.bindingX||this.chart.bindingX,h=i._getBinding(0),u=i._getBinding(1),c=i._getBinding(2),_=i._getBinding(3),g=i._getAxisY();return r.item=n._BasePlotter.cloneStyle(o,[]),r.item[h]=this._rangeValues[e].high,r.item[u]=this._rangeValues[e].low,r.item[c]=this._rangeValues[e].open,r.item[_]=this._rangeValues[e].close,r.y=this._rangeValues[e].close,r.yfmt=g._formatValue(this._rangeValues[e].close),r.x=r.item[l],r.xfmt=this._rangeXLabels[e]._text,r},e.prototype._init=function(){this._rangeValues=[],this._rangeXLabels=[]},e.prototype._calculate=function(t){},e.prototype._generateXLabels=function(t){var e,a=this,s=t._getAxisX(),r=t.getDataType(1)||this.chart._xDataType;this._rangeValues.forEach(function(t,o){var l=t.x;e=r===i.DataType.Date?i.Globalize.format(n.FlexChart._fromOADate(l),s.format||"d"):r===i.DataType.Number?s._formatValue(l):null!==r&&r!==i.DataType.String||!a.chart._xlabels?l.toString():a.chart._xlabels[l],a._rangeXLabels.push({value:o,text:e,_text:e})},this)},e}(n._BasePlotter);e._BaseRangePlotter=k;var V;!function(t){t[t.Close=0]="Close",t[t.High=1]="High",t[t.Low=2]="Low",t[t.Open=3]="Open",t[t.HighLow=4]="HighLow",t[t.HL2=5]="HL2",t[t.HLC3=6]="HLC3",t[t.HLOC4=7]="HLOC4"}(V=e.DataFields||(e.DataFields={}));var P;!function(t){t[t.Fixed=0]="Fixed",t[t.ATR=1]="ATR",t[t.Percentage=2]="Percentage"}(P=e.RangeMode||(e.RangeMode={}));var C=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.clear=function(){t.prototype.clear.call(this),this._newLineBreaks=null},e.prototype._calculate=function(t){this._init();var e=t._getBindingValues(3),n=t.getValues(1)||this.chart._xvals;this._calculator=new v(null,null,null,e,n,this._newLineBreaks),this._rangeValues=this._calculator.calculate(),(null===this._rangeValues||i.isUndefined(this._rangeValues))&&(this._rangeValues=[]),this._generateXLabels(t)},e.prototype._init=function(){t.prototype._init.call(this),this._newLineBreaks=i.asInt(this.getNumOption("newLineBreaks","lineBreak"),!0,!0)||3,i.assert(this._newLineBreaks>=1,"Value must be greater than 1")},e}(k);e._LineBreakPlotter=C;var A=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.clear=function(){t.prototype.clear.call(this),this._boxSize=null,this._rangeMode=null},e.prototype._calculate=function(t){this._init();var e=t._getBindingValues(0),n=t._getBindingValues(1),a=t._getBindingValues(2),s=t._getBindingValues(3),r=t.getValues(1)||this.chart._xvals;this._calculator=new w(e,n,a,s,r,this._boxSize,this._rangeMode,this._fields,this._rounding),this._rangeValues=this._calculator.calculate(),(null===this._rangeValues||i.isUndefined(this._rangeValues))&&(this._rangeValues=[]),this._generateXLabels(t)},e.prototype._init=function(){t.prototype._init.call(this),this._boxSize=this.getNumOption("boxSize","renko")||14,this._rangeMode=this.getOption("rangeMode","renko")||P.Fixed,this._rangeMode=i.asEnum(this._rangeMode,P,!0),i.assert(this._rangeMode!==P.Percentage,"RangeMode.Percentage is not supported"),this._fields=this.getOption("fields","renko")||V.Close,this._fields=i.asEnum(this._fields,V,!0),i.assert(this._fields!==V.HighLow,"DataFields.HighLow is not supported"),this._rounding=i.asBoolean(this.getOption("rounding","renko"),!0)},e.prototype._generateXLabels=function(e){var i=this;t.prototype._generateXLabels.call(this,e),this._rangeXLabels.forEach(function(t,e){e>0&&i._rangeXLabels[e-1]._text===t.text&&(t.text="")},this)},e}(k);e._RenkoPlotter=A;var L=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype._calculate=function(t){this._init();var e=t._getBindingValues(0),n=t._getBindingValues(1),a=t._getBindingValues(2),s=t._getBindingValues(3),r=t.getValues(1)||this.chart._xvals;this._calculator=new x(e,n,a,s,r,this._reversalAmount,this._rangeMode,this._fields),this._rangeValues=this._calculator.calculate(),(null===this._rangeValues||i.isUndefined(this._rangeValues))&&(this._rangeValues=[]),this._generateXLabels(t)},e.prototype.plotSeries=function(t,e,a,s,r,o,l){this._calculate(s);var h=this.chart.series.indexOf(s),u=this._rangeValues.length,c=e.actualMin,_=e.actualMax,g=this._DEFAULT_WIDTH,p=s._getSymbolStroke(h),d=s._getAltSymbolStroke(h)||p,f=[],m=[];t.stroke=p,t.strokeWidth=g;var y,v,x,w,b,k,V,P=0;t.startGroup();for(var C=0;C<u;C++)y=C,n._DataInfo.isValid(y)&&c<=y&&y<=_&&(v=this._rangeValues[C].open,x=this._rangeValues[C].close,0===C?(w=Math.min(v,x),b=Math.max(v,x),t.strokeWidth=v>x?g:2*g,t.stroke=v>x?p:d,t.drawLine(e.convert(y),a.convert(v),e.convert(y),a.convert(x)),t.drawLine(e.convert(y-1)-t.strokeWidth/2,a.convert(v),e.convert(y)+t.strokeWidth/2,a.convert(v))):t.strokeWidth===g?x>v?(x>b?(t.drawLine(e.convert(y),a.convert(v),e.convert(y),a.convert(b)),t.strokeWidth=2*g,t.stroke=d,t.drawLine(e.convert(y),a.convert(b),e.convert(y),a.convert(x)),w=v):t.drawLine(e.convert(y),a.convert(v),e.convert(y),a.convert(x)),b=x):t.drawLine(e.convert(y),a.convert(v),e.convert(y),a.convert(x)):t.strokeWidth/2===g&&(x<v?(x<w?(t.drawLine(e.convert(y),a.convert(v),e.convert(y),a.convert(w)),t.strokeWidth=g,t.stroke=p,t.drawLine(e.convert(y),a.convert(w),e.convert(y),a.convert(x)),b=v):t.drawLine(e.convert(y),a.convert(v),e.convert(y),a.convert(x)),w=x):t.drawLine(e.convert(y),a.convert(v),e.convert(y),a.convert(x))),C<u-1&&t.drawLine(e.convert(y)-t.strokeWidth/2,a.convert(x),e.convert(y+1)+t.strokeWidth/2,a.convert(x)),V=this._getDataPoint(h,C,s,x),(k=new n._CircleArea(new i.Point(e.convert(y),a.convert(x)),.5*t.strokeWidth)).tag=V,this.hitTester.add(k,h),s._setPointIndex(C,P),P++,f.push(e.convert(y)),m.push(a.convert(v)),f.push(e.convert(y)),m.push(a.convert(x)));t.endGroup(),this.hitTester.add(new n._LinesArea(f,m),h)},e.prototype._init=function(){t.prototype._init.call(this),this._reversalAmount=this.getNumOption("reversalAmount","kagi")||14,this._rangeMode=this.getOption("rangeMode","kagi")||P.Fixed,this._rangeMode=i.asEnum(this._rangeMode,P,!0),this._fields=this.getOption("fields","kagi")||V.Close,this._fields=i.asEnum(this._fields,V,!0)},e.prototype.clear=function(){t.prototype.clear.call(this),this._reversalAmount=null,this._rangeMode=null},e}(k);e._KagiPlotter=L;var M;!function(t){t[t.Traditional=0]="Traditional",t[t.Fixed=1]="Fixed",t[t.Dynamic=2]="Dynamic"}(M=e.PointAndFigureScaling||(e.PointAndFigureScaling={}));var S=function(t){function e(){return t.call(this)||this}return __extends(e,t),e.prototype.clear=function(){t.prototype.clear.call(this),this._boxSize=null,this._fields=null,this._reversal=null,this._scaling=null},e.prototype.unload=function(){t.prototype.unload.call(this),this.chart.axisX.itemsSource=this._xlbls},e.prototype._init=function(){this._boxSize=this.getNumOption("boxSize","pointAndFigure")||1,this._reversal=this.getNumOption("reversal","pointAndFigure")||3,this._period=this.getNumOption("period","pointAndFigure")||20,this._fields=this.getOption("fields","pointAndFigure")||V.Close,this._fields=i.asEnum(this._fields,V,!0),i.assert(this._fields==V.Close||this._fields==V.HighLow,"Only DataFields.Close and DataFields.HighLow are supported"),this._scaling=this.getOption("scaling","pointAndFigure")||M.Traditional,this._scaling=i.asEnum(this._scaling,M,!0),this._xlbls=[]},e.prototype.adjustLimits=function(t,e){this._init(),this.hitTester.clear();var n=new i.Rect(0,0,0,0),a=this.chart.series.length;if(i.assert(a<=1,"Current FinancialChartType only supports a single series"),a>0){var s=this.chart.series[0],r=this._reversal,o=s.collectionView?s.collectionView:this.chart.collectionView,l=o?o.items:null;if(l&&l.length>0){var h=s._getBinding(0),u=s._getBinding(1),c=s._getBinding(2),_=s._getBinding(3);this._fields==V.Close&&(_?h=_:c&&(h=c),u=h);var g=s.bindingX?s.bindingX:this.chart.bindingX,p=this._actualBoxSize=this.calcBoxSize(l,h,u);if(this._pfdata=this.calcPFHiLo2(l,h,u,g,p,r),this._pfdata&&this._pfdata.length>0){var d=this._pfdata.reduce(function(t,e){return Math.max(t,e.max)},this._pfdata[0].max),f=this._pfdata.reduce(function(t,e){return Math.min(t,e.min)},this._pfdata[0].min);n=new i.Rect(-.5,f-.5*p,this._pfdata.length,d-f+p);for(var m=1;m<this._pfdata.length;m++){var y=this._pfdata[m-1],v=this._pfdata[m];i.isDate(v.date)&&i.isDate(y.date)&&v.date.getYear()!=y.date.getYear()&&this._xlbls.push({value:m,text:i.Globalize.formatNumber(v.date.getFullYear()%100,"d2")})}}}}return 0==this._xlbls.length&&this._xlbls.push({value:0}),this.chart.axisY.majorGrid=!1,this.chart.axisX.itemsSource=this._xlbls,n},e.prototype.plotSeries=function(t,e,i,n,a,s,r){if(this._pfdata&&this._pfdata.length>0){var o=this._actualBoxSize;this.renderGrid(t,this._pfdata,o),this.renderData(this.chart,t,this._pfdata,o)}},e.prototype.calcBoxSize=function(t,e,i){var n=t.reduce(function(t,i){return Math.max(t,i[e])},t[0][e]),a=t.reduce(function(t,e){return Math.min(t,e[i])},t[0][i]),s=this._boxSize,r=n-a;switch(this._scaling){case M.Traditional:r<.25?s=.0625:r>=.25&&r<1?s=.125:r>=1&&r<5?s=.25:r>=5&&r<20?s=.5:r>=20&&r<100?s=1:r>=100&&r<200?s=2:r>=200&&r<500?s=4:r>=500&&r<1e3?s=5:r>=1e3&&r<25e3?s=50:r>-25e3&&(s=500);break;case M.Dynamic:var o=this.chart.series[0],l=o._getBindingValues(0),u=o._getBindingValues(1),c=(o._getBindingValues(2),h(l,u,o._getBindingValues(3),this._period));s=c[c.length-1]}return s},e.prototype.calcPFHiLo2=function(t,e,n,a,s,r){for(var o=[],l=0;l<t.length;l++){var h=t[l][e],u=t[l][n];i.assert(h>=u,"'High' value must be larger than 'low' value.");var c=t[l][a];if(0==o.length)o.push({min:this.roundDown(u,s),max:this.roundDown(h,s),rise:!1,date:c});else{var _=o[o.length-1];if(_.rise){var g=_.max+s,p=_.max-r*s;this.roundUp(h,s)>=g?_.max=this.roundUp(h,s):u<=p&&o.push({min:this.roundDown(u,s),max:_.max-s,rise:!1,date:c})}else{var g=_.min-s,p=_.min+r*s;this.roundDown(u,s)<=g?_.min=this.roundDown(u,s):h>=p&&o.push({min:_.min+s,max:this.roundUp(h,s),rise:!0,date:c})}}}if(o.length>0){var d=o[0];d.min==d.max&&o.splice(0,1)}return o},e.prototype.roundUp=function(t,e){return Math.ceil(t/e-.999999)*e},e.prototype.roundDown=function(t,e){return Math.floor(t/e+.999999)*e},e.prototype.renderGrid=function(t,e,a){if(this._pfdata){for(var s=this._pfdata.reduce(function(t,e){return Math.max(t,e.max)},this._pfdata[0].max),r=this._pfdata.reduce(function(t,e){return Math.min(t,e.min)},this._pfdata[0].min),o=this.chart,l=this._pfdata.length,h=r-.5*a;h<=s+a;h+=a){c=new i.Point(-.5,h);c=o.dataToPoint(c);_=new i.Point(l,h);_=o.dataToPoint(_),t.stroke=n.FlexChart._FG,t.strokeWidth=1,t.drawLine(c.x,c.y,_.x,_.y,n.FlexChart._CSS_GRIDLINE)}for(var u=-.5;u<=l;u+=1){var c=new i.Point(u,this.chart.axisY.actualMin);c=o.dataToPoint(c);var _=new i.Point(u,this.chart.axisY.actualMax);_=o.dataToPoint(_),t.stroke=n.FlexChart._FG,t.strokeWidth=1,t.drawLine(c.x,c.y,_.x,_.y,n.FlexChart._CSS_GRIDLINE)}}},e.prototype.renderData=function(t,e,a,s){for(var r=t.series[0],o=r._getSymbolStroke(0),l=r._getAltSymbolStroke(0)||o,h=0;h<a.length;h++){var u=a[h],c=(a[h].max-a[h].min)/s;if(0!=c){var _=new i.Point(h-.5,u.min);_=t.dataToPoint(_);var g=new i.Point(h+.5,u.max);g=t.dataToPoint(g),e.fill="transparent";for(var p=(g.y-_.y)/c,d=0;d<c+1;d++)if(e.strokeWidth=1.5,u.rise?(e.stroke=o,e.drawLine(_.x,_.y+(d-.5)*p,g.x,_.y+(d+.5)*p),e.drawLine(g.x,_.y+(d-.5)*p,_.x,_.y+(d+.5)*p)):(e.stroke=l,e.drawEllipse(.5*(_.x+g.x),_.y+d*p,.5*Math.abs(_.x-g.x),.5*Math.abs(p))),this.hitTester){var f=u.min+d*s,m=new n._DataPoint(0,h,u.date,f);m.y=f,m.yfmt=this.chart.axisY._formatValue(f),i.isDate(u.date)&&(m.x=u.date,m.xfmt=i.Globalize.formatDate(u.date,"d"));var y=new i.Rect(Math.min(_.x,g.x),_.y+d*p-.5*p,Math.abs(g.x-_.x),p);y.height<0&&(y.top+=p,y.height=-y.height);var v=new n._RectArea(y);v.tag=m,this.hitTester.add(v,0)}}}},e}(n._BasePlotter);e._PointAndFigurePlotter=S});