/* Your license agreement requires the use of the Modulus LicensePing.com licensing mechanism. The mechanism monitors the usage and distribution patterns of our intellectual property. If the usage or distribution patterns indicate that our licensing mechanism has either been removed, altered, tampered with or that our intellectual property may be misused in any form, our legal team may initiate contact with you to investigate the matter further. Removal or modification of this license mechanism by any means whatsoever (editing the code, removing the LicensePing.com URL reference, etc.) constitutes willful and criminal copyright infringement in addition to giving rise to claims by Modulus Financial Engineering, Inc. against you, as the developer, and your company as a whole for, among others: (1) Copyright Infringement; (2) False Designation of Origin; (3) Breach of Contract; (4) Misappropriation of Trade Secrets; (5) Interference with Contract; and (6) Interference with Prospective Business Relations. 17 USC 506 - Criminal offenses (a) Criminal Infringement. Any person who willfully infringes a copyright shall be punished as provided under section 2319 of title 18, if the infringement was committed for purposes of commercial advantage or private financial gain. 18 USC 2319 - Criminal infringement of a copyright (a) Any person who commits an offense under section 506 (a)(1)(A) of title 17 shall be imprisoned not more than 5 years, or fined in the amount set forth in this title (up to $150,000), or both, if the offense consists of the reproduction or distribution, including by electronic means, during any 180-day period, of at least 10 copies, of 1 or more copyrighted works, which have a total retail value of more than $2,500. For more information, review the license agreement associated with this software and source code at http://www.modulusfe.com/support/license.pdf or contact us at legal@modulusfe.com.*/ var TASdk !function(e){e.Const={nullValue:-987653421,mA_START:0,mA_END:7,simpleMovingAverage:0,exponentialMovingAverage:1,timeSeriesMovingAverage:2,triangularMovingAverage:3,variableMovingAverage:4,VIDYA:5,wellesWilderSmoothing:6,weightedMovingAverage:7},e.Unknown=-1,e.FirstIndicator=-1,e.SimpleMovingAverage=0,e.ExponentialMovingAverage=1,e.TimeSeriesMovingAverage=2,e.TriangularMovingAverage=3,e.VariableMovingAverage=4,e.VIDYA=5,e.WellesWilderSmoothing=6,e.WeightedMovingAverage=7,e.WilliamsPctR=8,e.WilliamsAccumulationDistribution=9,e.VolumeOscillator=10,e.VerticalHorizontalFilter=11,e.UltimateOscillator=12,e.TrueRange=13,e.AverageTrueRange=14,e.RainbowOscillator=15,e.PriceOscillator=16,e.ParabolicSAR=17,e.MomentumOscillator=18,e.MACD=19,e.EaseOfMovement=20,e.DirectionalMovementSystem=21,e.DetrendedPriceOscillator=22,e.ChandeMomentumOscillator=23,e.ChaikinVolatility=24,e.Aroon=25,e.AroonOscillator=26,e.LinearRegressionRSquared=27,e.LinearRegressionForecast=28,e.LinearRegressionSlope=29,e.LinearRegressionIntercept=30,e.PriceVolumeTrend=31,e.PerformanceIndex=32,e.CommodityChannelIndex=33,e.ChaikinMoneyFlow=34,e.WeightedClose=35,e.VolumeROC=36,e.TypicalPrice=37,e.StandardDeviation=38,e.PriceROC=39,e.MedianPrice=40,e.HighMinusLow=41,e.BollingerBands=42,e.FractalChaosBands=43,e.HighLowBands=44,e.MovingAverageEnvelope=45,e.SwingIndex=46,e.AccumulativeSwingIndex=47,e.ComparativeRelativeStrength=48,e.MassIndex=49,e.MoneyFlowIndex=50,e.NegativeVolumeIndex=51,e.OnBalanceVolume=52,e.PositiveVolumeIndex=53,e.RelativeStrengthIndex=54,e.TradeVolumeIndex=55,e.StochasticOscillator=56,e.StochasticMomentumIndex=57,e.FractalChaosOscillator=58,e.PrimeNumberOscillator=59,e.PrimeNumberBands=60,e.HistoricalVolatility=61,e.MACDHistogram=62,e.HHV=63,e.LLV=64,e.TimeSeriesForecast=65,e.TRIX=66,e.ElderRay=67,e.ElderForceIndex=68,e.ElderThermometer=69,e.EhlerFisherTransform=70,e.KeltnerChannel=71,e.MarketFacilitationIndex=72,e.SchaffTrendCycle=73,e.QStick=74,e.STARC=75,e.CenterOfGravity=76,e.CoppockCurve=77,e.ChandeForecastOscillator=78,e.GopalakrishnanRangeIndex=79,e.IntradayMomentumIndex=80,e.KlingerVolumeOscillator=81,e.PrettyGoodOscillator=82,e.RAVI=83,e.RandomWalkIndex=84,e.TwiggsMoneyFlow=85,e.LastIndicator=86,e.IchimokuCloud=87,e.indicatorToString=function(t){switch(t){case e.SimpleMovingAverage:return"Simple Moving Average" case e.ExponentialMovingAverage:return"Exponential Moving Average" case e.TimeSeriesMovingAverage:return"Time Series Moving Average" case e.TriangularMovingAverage:return"Triangular Moving Average" case e.VariableMovingAverage:return"Variable Moving Average" case e.VIDYA:return"Volatility Index Dynamic Average" case e.WellesWilderSmoothing:return"Welles Wilder Smoothing" case e.WeightedMovingAverage:return"Weighted Moving Average" case e.WilliamsPctR:return"Williams %R" case e.WilliamsAccumulationDistribution:return"Williams Accumulation Distribution" case e.VolumeOscillator:return"Volume Oscillator" case e.VerticalHorizontalFilter:return"Vertical Horizontal Filter" case e.UltimateOscillator:return"Ultimate Oscillator" case e.TrueRange:return"True Range" case e.AverageTrueRange:return"Average True Range" case e.TRIX:return"TRIX" case e.RainbowOscillator:return"Rainbow Oscillator" case e.PriceOscillator:return"Price Oscillator" case e.ParabolicSAR:return"Parabolic SAR" case e.MomentumOscillator:return"Momentum Oscillator" case e.MACD:return"MACD" case e.EaseOfMovement:return"Ease of Movement" case e.DirectionalMovementSystem:return"Directional Movement System" case e.DetrendedPriceOscillator:return"Detrended Price Oscillator" case e.ChandeMomentumOscillator:return"Chande Momentum Oscillator" case e.ChaikinVolatility:return"Chaikin Volatility" case e.Aroon:return"Aroon" case e.AroonOscillator:return"Aroon Oscillator" case e.LinearRegressionRSquared:return"Linear Regression R2" case e.LinearRegressionForecast:return"Linear Regression Forecast" case e.LinearRegressionSlope:return"Linear Regression Slope" case e.LinearRegressionIntercept:return"Linear Regression Intercept" case e.PriceVolumeTrend:return"Price Volume Trend" case e.PerformanceIndex:return"Performance Index" case e.CommodityChannelIndex:return"Commodity Channel Index" case e.ChaikinMoneyFlow:return"Chaikin Money Flow" case e.WeightedClose:return"Weighted Close" case e.VolumeROC:return"Volume Rate of Change" case e.TypicalPrice:return"Typical Price" case e.StandardDeviation:return"Standard Deviation" case e.PriceROC:return"Price Rate of Change" case e.MedianPrice:return"Median Price" case e.HighMinusLow:return"High Minus Low" case e.BollingerBands:return"Bollinger Bands" case e.FractalChaosBands:return"Fractal Chaos Bands" case e.HighLowBands:return"High Low Bands" case e.MovingAverageEnvelope:return"Moving Average Envelope" case e.SwingIndex:return"Swing Index" case e.AccumulativeSwingIndex:return"Accumulative Swing Index" case e.ComparativeRelativeStrength:return"Comparative Relative Strength" case e.MassIndex:return"Mass Index" case e.MoneyFlowIndex:return"Money Flow Index" case e.NegativeVolumeIndex:return"Negative Volume Index" case e.OnBalanceVolume:return"On Balance Volume" case e.PositiveVolumeIndex:return"Positive Volume Index" case e.RelativeStrengthIndex:return"Relative Strength Index" case e.TradeVolumeIndex:return"Trade Volume Index" case e.StochasticOscillator:return"Stochastic Oscillator" case e.StochasticMomentumIndex:return"Stochastic Momentum Index" case e.FractalChaosOscillator:return"Fractal Chaos Oscillator" case e.PrimeNumberOscillator:return"Prime Number Oscillator" case e.PrimeNumberBands:return"Prime Number Bands" case e.HistoricalVolatility:return"Historical Volatility" case e.MACDHistogram:return"MACD Histogram" case e.HHV:return"Highest High Value" case e.LLV:return"Lowest Low Value" case e.TimeSeriesForecast:return"Time Series Forecast" case e.ElderRay:return"Elder Ray" case e.ElderForceIndex:return"Elder Force Index" case e.ElderThermometer:return"Elder Thermometer" case e.EhlerFisherTransform:return"Ehler Fisher Transform" case e.KeltnerChannel:return"Keltner Channel" case e.MarketFacilitationIndex:return"Market Facilitation Index" case e.SchaffTrendCycle:return"Schaff Trend Cycle" case e.QStick:return"QStick" case e.STARC:return"Stoller Average Range Channel" case e.CenterOfGravity:return"Center Of Gravity" case e.CoppockCurve:return"Coppock Curve" case e.ChandeForecastOscillator:return"Chande Forecast Oscillator" case e.GopalakrishnanRangeIndex:return"Gopalakrishnan Range Index" case e.IntradayMomentumIndex:return"Intraday Momentum Index" case e.KlingerVolumeOscillator:return"Klinger Volume Oscillator" case e.PrettyGoodOscillator:return"Pretty Good Oscillator" case e.RAVI:return"RAVI" case e.RandomWalkIndex:return"Random Walk Index" case e.TwiggsMoneyFlow:return"Twiggs Money Flow" case e.IchimokuCloud:return"Ichimoku Cloud" case e.Unknown:return""}}}(TASdk||(TASdk={})),function(e){var t=function(){function t(){this._m_values=[],this.recordCount=0}return t.prototype.initialize=function(e,t){this.name=t,this.recordCount=e,this._m_values=Array(e+1) for(var i=0;in&&(n*=-1),n=n*a+(1-n)*o,i.setValue(s,n) return r.addField(i),r},t.prototype.triangularMovingAverage=function(t,i,r){var n,o,a,s,l,c=0,h=0,u=new e.Recordset a=t.recordCount,n=new e.Field,n.initialize(a,"MA1"),o=new e.Field,o.initialize(a,r),0e.Const.mA_END||1>i||i>s||0>n||100n||n>t.recordCount?null:(o=l.VIDYA(t,n,.8,"High Low Bands Top"),a=l.VIDYA(r,parseInt(n/2),.8,"High Low Bands Median"),s=l.VIDYA(i,n,.8,"High Low Bands Bottom"),c.addField(o.getField("High Low Bands Top")),c.addField(a.getField("High Low Bands Median")),c.addField(s.getField("High Low Bands Bottom")),o.removeField("High Low Bands Top"),a.removeField("High Low Bands Median"),s.removeField("High Low Bands Bottom"),c)},t.prototype.fractalChaosBands=function(t,i){var r,n=new e.MovingAverage,o=new e.Recordset,a=t.getFieldByIndex(0).recordCount 1>i&&(i=100) var s=new e.Field s.initialize(a,"Fractal High") var l=new e.Field l.initialize(a,"Low High"),(new e.Field).initialize(a,"HLM") var c=t.getField("High"),h=t.getField("Low"),u=new e.Field u.initialize(a,"FR") var d=new e.Field d.initialize(a,"High 1") var p=new e.Field p.initialize(a,"High 2") var f=new e.Field f.initialize(a,"High 3") var m=new e.Field m.initialize(a,"High 4") var v=new e.Field v.initialize(a,"Low 1") var g=new e.Field g.initialize(a,"Low 2") var y=new e.Field y.initialize(a,"Low 3") var _=new e.Field for(_.initialize(a,"Low 4"),r=5;rd.value(r)&&f.value(r)>p.value(r)&&f.value(r)>=m.value(r)&&f.value(r)>=c.value(r)?u.setValue(r,s.value(r)):u.setValue(r,0),u.value(r)||(y.value(r)e.Const.mA_END||1>i||i>l||0>r||100i&&(f.setValue(y,s),m.setValue(y,l),v.setValue(y,o),g.setValue(y,u))}return d.addField(f),d.addField(m),d.addField(v),d.addField(g),d},t.prototype.timeSeriesForecast=function(e,t,i){var r return r=this.regression(e,t),r.renameField("Forecast",i),r.removeField("Slope"),r.removeField("Intercept"),r.removeField("RSquared"),r},t}() e.LinearRegression=t}(TASdk||(TASdk={})),function(e){var t=function(){function t(){}return t.prototype.chandeMomentumOscillator=function(t,i,r){var n,o,a,s,l,c,h,u=new e.Recordset o=t.recordCount,n=new e.Field,n.initialize(o,r) var d for(r=i+2;rl?c+=s-l:so&&(o=r),n>o&&(o=n) var y for(o+=2;ol&&(l=t.value(r)),r++ for(h=0,r=o-i,s=1;su&&(u*=-1),h+=u,r++ u=(l-c)/h,0>u&&(u*=-1),n.setValue(r-1,u)}return d.addField(n),d},t.prototype.williamsPctR=function(t,i,r){var n,o,a,s,l,c,h=new e.Recordset for(a=t.getFieldByIndex(0).recordCount,n=new e.Field,n.initialize(a,r),r=o=i+2;ol&&(l=t.getField("High").value(r)),t.getField("Low").value(r)a&&(a=t.getField("High").value(c)),s=t.getField("Close").value(c-1),t.getField("Low").value(c)t.getField("Close").value(c-1)?t.getField("Close").value(c)-s:t.getField("Close").value(c)u&&(u=t.getField("High").value(m)),t.getField("Low").value(m)r?i:r>i?r:i;rc&&(c=t.value(l),uh&&(v=1,u=r,h=f,d=0,c=t.value(l))),p=c,f=d,g=h,o=u,a.setValue(l,h) return m.addField(a),m},t.prototype.directionalMovementSystem=function(t,i){var r,n,o,a,s,l r=new e.MovingAverage var c,h,u,d,p=new e.Recordset,f=new e.Recordset for(u=t.getFieldByIndex(0).recordCount,s=this.trueRange(t,"TR"),a=s.getField("TR"),s.removeField("TR"),l=r.wellesWilderSmoothing(a,i,"TRSum"),o=new e.Field,o.initialize(u,"UpDMI"),n=new e.Field,n.initialize(u,"DnDMI"),a=new e.Field,a.initialize(u,"DI-"),s=new e.Field,s.initialize(u,"DI+"),d=2;dc&&0>h||c===h?(o.setValue(d,0),n.setValue(d,0)):c>h?(o.setValue(d,c),n.setValue(d,0)):cl.value(t)&&h.value(t)>c.value(t)&&h.value(t)>=u.value(t)&&h.value(t)>=o.value(t)&&s.setValue(t,1),f.value(t)l&&(l*=10),s=l;1i&&(i=13) var s=new e.Field,l=new e.Field s.initialize(a,n+" Bull Power"),l.initialize(a,n+" Bear Power") var c=t.getField("Close") for(n=t.getField("High"),t=t.getField("Low"),r=(new e.MovingAverage).movingAverageSwitch(c,i,r,"ema").getField("ema"),i+=1;ii&&(i=10) var o=t.getFieldByIndex(0).recordCount,a=new e.Field a.initialize(o,r) var s=new e.Field s.initialize(o,r+" Trigger") var l=new e.General t=l.medianPrice(t,"price").getField("price"),r=l.HHV(t,i,"maxh").getField("maxh"),i=l.LLV(t,i,"minl").getField("minl") for(var c,l=c=0,h=1;hc&&(c=-.999),u=.5*Math.log((1+c)/(1-c))+.5*l,a.setValue(h,u),s.setValue(h,l),l=u}return n.addField(a),n.addField(s),n},t.prototype.schaffTrendCycle=function(i,r,n,o,a,s){var l=new e.Recordset,c=i.recordCount,h=new e.Field h.initialize(c,"x") var u=new e.Field u.initialize(c,"x") var d=new e.Field d.initialize(c,"x") var p=new e.Field for(p.initialize(c,s),s=new e.General,o=(new t).MACD(i,2,o,n,a,"x").getField("x"),a=s.LLV(o,r,"x").getField("x"),i=s.HHV(o,r,"x").getField("x"),n=1;nr-i;--h)s+=t.value(h)*(c+1),l+=t.value(h),c++ a.setValue(r,-1*s/l)}return n.addField(a),n},t.prototype.coppockCurve=function(t,i){var r=(new e.Recordset,t.recordCount),n=new e.Field n.initialize(r,i) for(var o=new e.General,a=o.priceROC(t,14,"x").getField("x"),o=o.priceROC(t,11,"x").getField("x"),s=1;s=i.value(u-1)?h.setValue(u,c.value(u)):h.setValue(u,-1*c.value(u)) return(new t).MACD(h,r,n,o,a,s)},t.prototype.prettyGoodOscillator=function(t,i,r){var n=new e.Recordset,o=t.getFieldByIndex(0).recordCount,a=new e.Field a.initialize(o,r),r=t.getField("Close"),(new e.Field).initialize(o,"sv") var s=new e.MovingAverage,l=s.simpleMovingAverage(t.getField("Close"),i,"x").getField("x") for(t=this.trueRange(t,"x").getField("x"),t=s.exponentialMovingAverage(t,i,"x").getField("x"),s=2;sc&&(c=t.value("High",l),u=l),t.value("Low",l)c&&(c=a),s>c&&(c=s),l>c&&(c=l),r.setValue(o,c) return r.name=i,h.addField(r),h},t.prototype.MACD=function(t,i,r,n,o,a){var s,l,c,h,u=new e.Recordset,d=new e.MovingAverage for(c=t.recordCount,s=new e.Field,s.initialize(c,a),r=d.movingAverageSwitch(t,r,o,"MA"),t=d.movingAverageSwitch(t,n,o,"MA"),n=1;nn&&(n*=-1),0>o&&(o*=-1),a+=n*o return 1-(a/=r-2)},t.prototype.HHV=function(t,i,r){var n,o,a=new e.Recordset new e.MovingAverage var s for(o=t.recordCount,n=new e.Field,n.initialize(o,r),r=i+1;r<=o;++r){s=t.value(r) for(var l=r;l>r-i-1;--l)t.value(l)>s&&(s=t.value(l)) n.setValue(r,s)}return a.addField(n),a},t.prototype.LLV=function(t,i,r){var n,o,a=new e.Recordset new e.MovingAverage var s for(o=t.recordCount,n=new e.Field,n.initialize(o,r),r=i+1;r<=o;++r){s=t.value(r) for(var l=r;l>r-i-1;--l)t.value(l)i||i>d)return null n=new e.Field,n.initialize(d,r) var m for(r=i+2;rl&&(l=1),s=(t.getField("High").value(m)+t.getField("Low").value(m)+t.getField("Close").value(m))/3,s>a?c+=s*l:sr?c=1:s<-r&&(c=-1),s<=r&&s>=-r&&(c=h),h=c,1===c?u+=i.value(d):-1===c&&(u-=i.value(d)),u/=1e4,o.setValue(d,u),d++ return l.addField(o),l},t.prototype.swingIndex=function(t,i,r){var n,o,a,s,l,c,h,u,d,p,f,m,v=new e.Recordset,g=0 if(o=t.getFieldByIndex(0).recordCount,0>=i)return null n=new e.Field,n.initialize(o,r) var y=2 for(r=2;rMath.abs(u-a)?Math.abs(h-a):Math.abs(u-a)>Math.abs(h-a)?Math.abs(u-a):Math.abs(h-a),p=Math.abs(h-a),f=Math.abs(u-a),m=Math.abs(h-u),p>f&&p>m?g=Math.abs(h-a)-.5*Math.abs(u-a)+.25*Math.abs(a-l):f>p&&f>m?g=Math.abs(u-a)-.5*Math.abs(h-a)+.25*Math.abs(a-l):m>p&&m>f&&(g=Math.abs(h-u)+.25*Math.abs(a-l)),a=0i.value(l-1)?n.value(l-1)+(t.value(l)-t.value(l-1))/t.value(l-1)*n.value(l-1):n.value(l-1),n.setValue(l,a),l++ return s.addField(n),s},t.prototype.negativeVolumeIndex=function(t,i,r){var n,o,a,s=new e.Recordset o=t.recordCount,n=new e.Field,n.initialize(o,r) var l=2 for(n.setValue(1,1),r=2;ri||i>c)return null n=new e.Field,n.initialize(c,r),r=s.highMinusLow(t,"HML").getField("HML"),t=o.exponentialMovingAverage(r,9,"EMA"),r=t.getField("EMA"),o=o.exponentialMovingAverage(r,9,"EMA") var h for(r=2*i+1;ra.value(d)?l=h+(s.value(d)-a.value(d)):c=u+(a.value(d)-s.value(d)),o.setValue(d,l/(l+c)*100),h=l,u=c return r.addField(o),r},t.prototype.RAVI=function(t,i,r,n){var o=new e.Recordset,a=t.recordCount,s=new e.Field for(s.initialize(a,n),n=new e.MovingAverage,i=n.VIDYA(t,i,.65,"x").getField("x"),t=n.VIDYA(t,r,.65,"x").getField("x"),n=1;nc-i;--h)a.setValue(c,(r.value(c)-l.value(h))/(t.value(h)*Math.sqrt(h))),s.setValue(c,(r.value(h)-l.value(c))/(t.value(h)*Math.sqrt(h))) for(c=1;c<2*i;c++)a.setValue(c,0),s.setValue(c,0) return n.addField(a),n.addField(s),n},t.prototype.trendIntensityIndex=function(t,i,r,n){var o=new e.Recordset,a=t.recordCount,s=new e.Field for(s.initialize(a,n),n=new e.MovingAverage,i=n.VIDYA(t,i,.65,"x").getField("x"),t=n.VIDYA(t,r,.65,"x").getField("x"),n=1;nt.value(m-1)?(h=t.value(m)-t.value(m-1),d+=h):t.value(m)t.value(m-1)?(h=t.value(m)-t.value(m-1),d+=h):t.value(m)e},e.isPositiveNumberOrNaN=function(e){return this.isNumber(e)&&(isNaN(e)||0").text(e).html().trim()},e.flattenArray=function(e){var t=this return e.reduce(function(e,i){return Array.isArray(i)?e.concat(t.flattenArray(i)):e.concat(i)},[])},e}() e.JsUtil=t,Math.roundToDecimals=function(e,t){return Number(Math.round(e+"E"+t)+"E-"+t)},Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)})}(StockChartX||(StockChartX={})),StockChartX||(StockChartX={}),function(e){e.TimeSpan={MILLISECONDS_IN_YEAR:31556926e3,MILLISECONDS_IN_MONTH:2629743830,MILLISECONDS_IN_WEEK:6048e5,MILLISECONDS_IN_DAY:864e5,MILLISECONDS_IN_HOUR:36e5,MILLISECONDS_IN_MINUTE:6e4,MILLISECONDS_IN_SECOND:1e3},Object.freeze(e.TimeSpan),e.Periodicity={TICK:"t",SECOND:"s",MINUTE:"",HOUR:"h",DAY:"d",WEEK:"w",MONTH:"m",YEAR:"y"},Object.freeze(e.Periodicity) var t=function(){function t(t,i){this.periodicity=t||e.Periodicity.MINUTE,this.interval=e.JsUtil.isFiniteNumber(i)?i:1}return t.prototype.toString=function(){return this.interval+" "+t.periodicityToString(this.periodicity)},t.prototype.toShortString=function(){return this.interval+" "+t.periodicityToShortString(this.periodicity)},t.periodicityToString=function(t){switch(t){case e.Periodicity.TICK:return"tick" case e.Periodicity.SECOND:return"second" case e.Periodicity.MINUTE:return"minute" case e.Periodicity.HOUR:return"hour" case e.Periodicity.DAY:return"day" case e.Periodicity.WEEK:return"week" case e.Periodicity.MONTH:return"month" case e.Periodicity.YEAR:return"year" default:throw Error("Unsupported periodicity: "+t)}},t.periodicityToShortString=function(t){switch(t){case e.Periodicity.TICK:return"tick" case e.Periodicity.SECOND:return"sec" case e.Periodicity.MINUTE:return"min" case e.Periodicity.HOUR:return"hr" case e.Periodicity.DAY:return"day" case e.Periodicity.WEEK:return"wk" case e.Periodicity.MONTH:return"mo" case e.Periodicity.YEAR:return"yr" default:throw Error("Unsupported periodicity: "+t)}},t.timeFrameToTimeInterval=function(t,i){switch(i){case e.Periodicity.TICK:return t case e.Periodicity.SECOND:return t*e.TimeSpan.MILLISECONDS_IN_SECOND case e.Periodicity.MINUTE:return t*e.TimeSpan.MILLISECONDS_IN_MINUTE case e.Periodicity.HOUR:return t*e.TimeSpan.MILLISECONDS_IN_HOUR case e.Periodicity.DAY:return t*e.TimeSpan.MILLISECONDS_IN_DAY case e.Periodicity.WEEK:return t*e.TimeSpan.MILLISECONDS_IN_WEEK case e.Periodicity.MONTH:return t*e.TimeSpan.MILLISECONDS_IN_MONTH case e.Periodicity.YEAR:return t*e.TimeSpan.MILLISECONDS_IN_YEAR}return 0},t.timeIntervalToTimeFrame=function(i){if(i>=e.TimeSpan.MILLISECONDS_IN_YEAR)return new t(e.Periodicity.YEAR,i/e.TimeSpan.MILLISECONDS_IN_YEAR) if(i>=e.TimeSpan.MILLISECONDS_IN_MONTH)return new t(e.Periodicity.MONTH,i/e.TimeSpan.MILLISECONDS_IN_MONTH) if(i>=e.TimeSpan.MILLISECONDS_IN_WEEK&&0==i%e.TimeSpan.MILLISECONDS_IN_WEEK)return new t(e.Periodicity.WEEK,i/e.TimeSpan.MILLISECONDS_IN_WEEK) if(i>=e.TimeSpan.MILLISECONDS_IN_DAY)return new t(e.Periodicity.DAY,i/e.TimeSpan.MILLISECONDS_IN_DAY) if(i>=e.TimeSpan.MILLISECONDS_IN_HOUR)return new t(e.Periodicity.HOUR,i/e.TimeSpan.MILLISECONDS_IN_HOUR) if(i>=e.TimeSpan.MILLISECONDS_IN_MINUTE)return new t(e.Periodicity.MINUTE,i/e.TimeSpan.MILLISECONDS_IN_MINUTE) if(i>=e.TimeSpan.MILLISECONDS_IN_SECOND)return new t(e.Periodicity.SECOND,i/e.TimeSpan.MILLISECONDS_IN_SECOND) throw Error("Unsupported time interval: "+i)},t}() e.TimeFrame=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){}return Object.defineProperty(t,"registeredFormatters",{get:function(){return this._formatters.registeredItems},enumerable:!0,configurable:!0}),t.register=function(e,t){"string"==typeof e?this._formatters.register(e,t):this._formatters.register(e.className,e)},t.deserialize=function(e){if(!e)return null var t=this._formatters.createInstance(e.className) return t.loadState(e),t},t._formatters=new e.ClassRegistrar,t}(),i=function(){function e(e){this._locale=e}return Object.defineProperty(e,"className",{get:function(){return""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"locale",{get:function(){return this._locale},set:function(e){this._locale!==e&&(this._locale=e,this._onLocaleChanged())},enumerable:!0,configurable:!0}),e.prototype._onLocaleChanged=function(){},e.prototype.saveState=function(){return{className:this.constructor.className,locale:this.locale}},e.prototype.loadState=function(e){this._locale=e&&e.locale},e}() e.NumberFormat=i,e.JsUtil.applyMixins(i,[t])}(StockChartX||(StockChartX={})) var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)} !function(e){var t=function(t){function i(e,i){t.call(this,e),this._createFormat(i)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.IntlNumberFormat"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"options",{get:function(){return this._numberFormat.resolvedOptions()},set:function(e){this._createFormat(e)},enumerable:!0,configurable:!0}),i.prototype._onLocaleChanged=function(){this._createFormat()},i.prototype._createFormat=function(e){var t=this.locale||"en" e||(e=this._numberFormat&&this._numberFormat.resolvedOptions()),this._numberFormat=new Intl.NumberFormat(t,e||void 0)},i.prototype.format=function(e){return this._numberFormat.format(e)},i.prototype.setDecimalDigits=function(t){if(e.JsUtil.isNegativeNumber(t))throw Error("Value must be greater or equal to zero.") var i=this._numberFormat.resolvedOptions() i.minimumFractionDigits=i.maximumFractionDigits=t,this._createFormat(i)},i.prototype.saveState=function(){var i=t.prototype.saveState.call(this) return i.options=e.JsUtil.clone(this.options),i},i.prototype.loadState=function(e){t.prototype.loadState.call(this,e),this._createFormat(e&&e.options)},i}(e.NumberFormat) e.IntlNumberFormat=t,e.NumberFormat.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this),this.formatString=e||"%f"}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.CustomNumberFormat"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"formatString",{get:function(){return this._formatString},set:function(e){this._formatString=e,this._parseFormat()},enumerable:!0,configurable:!0}),i.prototype._parseFormat=function(){var e=this.formatString if(!e||"string"!=typeof e)throw new TypeError("Format specifier must be a string.") e=/%(\+)?([0 ]|'(.))?(-)?([0-9]+)?(\.([0-9]+))?([bcdfoxXeEgG])/g.exec(e),this._options={sign:"+"===e[1],padding:null==e[2]?" ":"'"===e[2].substring(0,1)?e[3]:e[2],alignLeft:"-"===e[4],width:null!=e[5]&&e[5],precision:null!=e[7]&&e[7],type:e[8]}},i.prototype.format=function(t){var i,r=Number(t),n=this._options switch(n.type){case"b":i=r.toString(2) break case"c":i=String.fromCharCode(r) break case"d":i=parseInt(r,10).toString() break case"f":i=!1===n.precision?t.toString():r.toFixed(n.precision) break case"o":i=r.toString(8) break case"x":i=r.toString(16).toLowerCase() break case"X":i=r.toString(16).toUpperCase() break case"e":case"E":i=!1===n.precision?r.toExponential():r.toExponential(n.precision),i="e"===n.type?i.toLowerCase():i.toUpperCase() break case"g":case"G":i=!1===n.precision?t.toString():r.toFixed(n.precision),r=!1===n.precision?r.toExponential():r.toExponential(n.precision),i=i.lengthi.length,r&&!n.alignLeft&&" "!==n.padding&&(i=e.JsUtil.padStr(i,n),r=!1),n.type){case"d":case"f":case"e":case"E":case"g":case"G":0>t?"-"!==i[0]&&(i="-"+i):n.sign&&(i="+"+i)}return r&&(i=e.JsUtil.padStr(i,n)),i},i.prototype.saveState=function(){var e=t.prototype.saveState.call(this) return e.formatString=this.formatString,e},i.prototype.loadState=function(e){t.prototype.loadState.call(this,e),this.formatString=e&&e.formatString},i}(e.NumberFormat) e.CustomNumberFormat=t,e.NumberFormat.register(t)}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){}return Object.defineProperty(t,"registeredFormatters",{get:function(){return this._formatters.registeredItems},enumerable:!0,configurable:!0}),t.register=function(e,t){"string"==typeof e?this._formatters.register(e,t):this._formatters.register(e.className,e)},t.deserialize=function(e){if(!e)return null var t=this._formatters.createInstance(e.className) return t.loadState(e),t},t._formatters=new e.ClassRegistrar,t}(),i=function(){function e(){}return Object.defineProperty(e,"className",{get:function(){return""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"locale",{get:function(){return this._locale},set:function(e){this._locale!==e&&(this._locale=e,this._onLocaleChanged())},enumerable:!0,configurable:!0}),e.prototype._onLocaleChanged=function(){},e.prototype.saveState=function(){return{className:this.constructor.className,locale:this.locale}},e.prototype.loadState=function(e){this.locale=e.locale},e}() e.DateTimeFormat=i,e.JsUtil.applyMixins(i,[t])}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(t){e.call(this),this.formatString=t}return __extends(t,e),Object.defineProperty(t,"className",{get:function(){return"StockChartX.CustomDateTimeFormat"},enumerable:!0,configurable:!0}),t.prototype.format=function(e){return e=moment(e),moment.locale(this.locale),e.format(this.formatString)},t.prototype.saveState=function(){var t=e.prototype.saveState.call(this) return t.formatString=this.formatString,t},t.prototype.loadState=function(t){e.prototype.loadState.call(this,t),this.formatString=t.formatString},t}(e.DateTimeFormat) e.CustomDateTimeFormat=t,e.DateTimeFormat.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.DateTimeFormatName={YEAR_MONTH:"year-month",MONTH_DAY:"month-day",DATE:"date",SHORT_DATE_TIME:"short_date_time",LONG_DATE_TIME:"long_date_time",SHORT_TIME:"short_time",LONG_TIME:"long_time"} var t=function(t){function i(e){t.call(this),this._formatters={},this._timeInterval=e}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.TimeIntervalDateTimeFormat"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"timeInterval",{get:function(){return this._timeInterval},set:function(e){this._timeInterval=e},enumerable:!0,configurable:!0}),i.prototype._onLocaleChanged=function(){this._clearFormatters()},i.prototype._clearFormatters=function(){this._formatters={}},i.prototype._createFormatter=function(e){return new IntlPolyfill.DateTimeFormat(this.locale||"en",e)},i.prototype.format=function(t){var i=this._timeInterval if(i>=e.TimeSpan.MILLISECONDS_IN_YEAR)return t.getFullYear().toString() var r=e.DateTimeFormatName return i>=e.TimeSpan.MILLISECONDS_IN_MONTH?this.formatter(r.YEAR_MONTH).format(t):i>=e.TimeSpan.MILLISECONDS_IN_DAY?this.formatter(r.DATE).format(t):i>=e.TimeSpan.MILLISECONDS_IN_MINUTE?this.formatter(r.SHORT_DATE_TIME).format(t):i>=e.TimeSpan.MILLISECONDS_IN_SECOND?this.formatter(r.SHORT_DATE_TIME).format(t):this.formatter(r.LONG_DATE_TIME).format(t)},i.prototype.formatWithFormatter=function(e,t){return this.formatter(t).format(e)},i.prototype.formatter=function(t){var i=this._formatters[t] if(i)return i switch(i=e.DateTimeFormatName,t){case i.YEAR_MONTH:i=this._createFormatter({year:"numeric",month:"short"}) break case i.MONTH_DAY:i=this._createFormatter({month:"short",day:"2-digit"}) break case i.DATE:i=this._createFormatter({year:"numeric",month:"short",day:"2-digit"}) break case i.SHORT_DATE_TIME:i=this._createFormatter({year:"numeric",month:"short",day:"2-digit",hour:"2-digit",hour12:!1,minute:"2-digit"}) break case i.LONG_DATE_TIME:i=this._createFormatter({year:"numeric",month:"short",day:"2-digit",hour:"2-digit",hour12:!1,minute:"2-digit",second:"2-digit"}) break case i.SHORT_TIME:i=this._createFormatter({hour:"2-digit",hour12:!1,minute:"2-digit"}) break case i.LONG_TIME:i=this._createFormatter({hour:"2-digit",hour12:!1,minute:"2-digit",second:"2-digit"}) break default:throw Error("Unknown formatter name: "+t)}return this._formatters[t]=i,i},i.prototype.saveState=function(){var e=t.prototype.saveState.call(this) return e.timeInterval=this.timeInterval,e},i.prototype.loadState=function(e){t.prototype.loadState.call(this,e),this.timeInterval=e&&e.timeInterval},i}(e.DateTimeFormat) e.TimeIntervalDateTimeFormat=t,e.DateTimeFormat.register(t)}(StockChartX||(StockChartX={})) var Chart=StockChartX.Chart !function(e){var t=jQuery t.fn.extend({scxGetFrame:function(t){var i=this.outerWidth(),r=this.outerHeight() if(t){var n=t.offset() t=this.offset(),t.left-=n.left,t.top-=n.top}else t=this.position() return new e.Rect({left:t.left,top:t.top,width:i,height:r})},scxSize:function(){return{width:this.outerWidth(),height:this.outerHeight()}},scxContentSize:function(){return{width:this.innerWidth(),height:this.innerHeight()}},scxAppendCanvas:function(){return t("").css("position","absolute").appendTo(this)},scxAppend:function(e,i){var r=t("<"+e+">").appendTo(this) if(i)if("string"==typeof i)r.addClass(i) else for(var n=0;nr.length&&(r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]) for(var n,o="#",a=0;3>a;a++)n=parseInt(r.substr(2*a,2),16),n=Math.round(Math.min(Math.max(0,n+255*i),255)).toString(16),o+=("00"+n).substr(n.length) return o},e.setVisibility=function(e,t){e.css("visibility",t?"visible":"hidden")},e.isFullScreenAllowed=function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled},e.isFullScreenEnabled=function(){return!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)},e.goFullScreen=function(e){e=e||document.body,e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)},e.exitFullScreen=function(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},e.setGradientBackground=function(t,i){var r="startColorstr="+e.toHexString(i[1]),n="endColorstr="+e.toHexString(i[0]) t.css("background","-webkit-gradient(linear,left bottom,left top,color-stop(0, "+i[0]+"), color-stop(1, "+i[1]+"))").css("background","linear-gradient(to top, "+i[0]+", "+i[1]+")").css("filter","progid:DXImageTransform.Microsoft.gradient(GradientType=0, "+r+", "+n+")")},e.setBackgroundColor=function(e,t){e.css("background-color",t)},e.removeUnsecureTags=function(e){e=$(e) for(var t=0,i="script embed object applet iframe frame frameset".split(" ");ti)throw Error("Not enough points.") this.beginPath(),this.moveTo(e[0].x,e[0].y) for(var r=1;r=this.left&&e.x<=this.right&&e.y>=this.top&&e.y<=this.bottom},e.prototype.cropLeft=function(e){e=e.right,this.left=e.left&&(this.width=e.left-1-this.left)},e.prototype.cropTop=function(e){e=e.bottom,this.tope.top&&(this.height=e.top-this.top)},e.prototype.copyFrom=function(e){this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height},e.prototype.applyPadding=function(e){e.left&&(this.left+=e.left,this.width-=e.left),e.top&&(this.top+=e.top,this.height-=e.top),e.right&&(this.width-=e.right),e.bottom&&(this.height-=e.bottom)},e}() e.Rect=t}(StockChartX||(StockChartX={})),function(e){!function(t){t.DEVIATION=e.Environment.isMobile?20:5,t.length=function(e,t){var i=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y) return Math.round(Math.sqrt(i*i+r*r))},t.xProjectionLength=function(e,t){return Math.abs(e.x-t.x)},t.yProjectionLength=function(e,t){return Math.abs(e.y-t.y)},t.isValueNearValue=function(e,t){return Math.abs(e-t)<=this.DEVIATION},t.isValueBetweenOrNearValues=function(e,t,i){return e>=Math.min(t,i)-this.DEVIATION&&e<=Math.max(t,i)+this.DEVIATION},t.isPointNearPoint=function(e,t){if(Array.isArray(t)){for(var i=0;it.length)return!1 for(var i=0;i=Math.abs(r-90)||10>=Math.abs(r-270)?this.isValueNearValue((e.y-(t.y-t.x*i))/i,e.x):this.isValueNearValue(t.y+i*(e.x-t.x),e.y)},t.isPointNearPolyline=function(e,t){for(var i=0,r=t.length;ii}}(e.Geometry||(e.Geometry={}))}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){this._eventsDispatcher=new e.EventsDispatcher,this._suppressEvents=!1,this._event={type:null,sender:this,target:this,value:void 0,oldValue:void 0}}return t.prototype.suppressEvents=function(e){var t=this._suppressEvents return this._suppressEvents=null==e||e,t},t.prototype.on=function(e,t,i){return this._eventsDispatcher.on(e,t,i),this},t.prototype.off=function(e,t){return this._eventsDispatcher.off(e,t),this},t.prototype.fire=function(e,t){this._suppressEvents||(t&&(t.sender=this),this._eventsDispatcher.fire(e,t))},t.prototype.fireValueChanged=function(e,t,i){this.fireTargetValueChanged(this,e,t,i)},t.prototype.fireTargetValueChanged=function(e,t,i,r){if(!this._suppressEvents){var n=this._event n.target=e||this,n.value=i,n.oldValue=r,this.fire(t,n)}},t}() e.EventableObject=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(){this._listeners={}}return e.prototype.on=function(e,t,i){e=e.split(" ") for(var r=this._listeners,n=0;n=o)throw Error("Width must be a positive number.") var a=n.height||600 if(0>=a)throw Error("Height must be a positive number.") this._instrument=n.instrument,this.timeInterval=n.timeInterval||i,this._loadOptionsState(n),this._valueMarker=new e.ValueMarker,this._dateMarker=new e.DateMarker,this._selectionMarker=new e.SelectionMarker({chart:this}),this._layoutHtmlElements(o,a),this._applyTheme(),this._dataManager=new e.DataManager,this._dataManager.addBarDataSeries(),this._dateScale=new e.DateScale({chart:this}),this.valueScales.push(new e.ValueScale({chart:this})),this._chartPanelsContainer=new e.ChartPanelsContainer({chart:this}),this._crossHair=new e.CrossHair({chart:this}),null!=n.crossHair&&(this.crossHairType=n.crossHair),this._priceStyle=new e.CandlePriceStyle({chart:this}),this._priceStyle.apply(),null!=n.priceStyle&&(this.priceStyleKind=n.priceStyle),this._subscribeEvents(),this.layout(),!1!==n.showToolbar&&(e.JsUtil.isFunction(n.onToolbarLoaded)&&this.on(e.ChartEvent.TOOLBAR_LOADED,n.onToolbarLoaded),this._container.scx().toolbar(this)),!1!==n.showNavigation&&this._rootDiv.scx().chartNavigation(this),n.fullWindowMode&&this.toggleFullWindow(),this._trackFullScreen()}return __extends(n,r),Object.defineProperty(n,"version",{get:function(){return"2.15.3"},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"container",{get:function(){return this._container},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"rootDiv",{get:function(){return this._rootDiv},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"dateScale",{get:function(){return this._dateScale},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"valueScales",{get:function(){return this._valueScales},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"valueScale",{get:function(){return this._valueScales[0]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"chartPanelsContainer",{get:function(){return this._chartPanelsContainer},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"dataManager",{get:function(){return this._dataManager},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"timeInterval",{get:function(){return this._timeInterval},set:function(t){t=parseInt(t,10) var i=this._timeInterval if(i!=t){if(!isFinite(t)||0>=t)throw Error("Time interval must be greater than 0.") this._timeInterval=t,this.fireValueChanged(e.ChartEvent.TIME_INTERVAL_CHANGED,t,i)}},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"chartPanelsFrame",{get:function(){return this._chartPanelsFrame},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"instrument",{get:function(){return this._instrument},set:function(t){this._instrument=t,this.fireValueChanged(e.ChartEvent.INSTRUMENT_CHANGED,t,t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"indicators",{get:function(){return this._indicators},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"valueMarker",{get:function(){return this._valueMarker},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"dateMarker",{get:function(){return this._dateMarker},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"locale",{get:function(){return this._options.locale},set:function(t){var i=this._options.locale i!=t&&(this._options.locale=t,this.fireValueChanged(e.ChartEvent.LOCALE_CHANGED,t,i))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"keyboardEventsEnabled",{get:function(){return this._options.enableKeyboardEvents},set:function(t){this._options.enableKeyboardEvents=!!t,this.fireValueChanged(e.ChartEvent.ENABLE_KEYBOARD_EVENTS_CHANGED,this._options.enableKeyboardEvents)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"mouseEventsEnabled",{get:function(){return this._options.enableMouseEvents},set:function(t){this._options.enableMouseEvents=!!t,this.fireValueChanged(e.ChartEvent.ENABLE_MOUSE_EVENTS_CHANGED,this._options.enableMouseEvents)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"theme",{get:function(){return this._options.theme},set:function(t){var i=this._options.theme this._options.theme=t,this._applyTheme(),this.updateIndicators(),this.fireValueChanged(e.ChartEvent.THEME_CHANGED,t,i)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showBarInfoInTitle",{get:function(){return this._options.showBarInfoInTitle},set:function(e){this._options.showBarInfoInTitle=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"priceStyle",{get:function(){return this._priceStyle},set:function(t){var i=this.priceStyle if(i!==t){var r=this.dateRange() this._priceStyle.destroy(),t.chart=this,this._priceStyle=t,this._priceStyle.apply() var n=this.dateScale,o=n.projection,a=o.recordByX(o.xByDate(r.startDate,!1),!1),r=o.recordByX(o.xByDate(r.endDate,!1),!1) n.canSetVisibleRecord(a)&&n.canSetVisibleRecord(r)?(this.firstVisibleRecord=a,this.lastVisibleRecord=r-1,this.lastVisibleRecord-this.firstVisibleRecord=t)throw new TypeError("Positive number expected.") this.firstVisibleRecord=Math.max(r-t,0),this.lastVisibleRecord=r-1}else{if(!e.JsUtil.isFiniteNumber(t)||0>t)throw new TypeError("First record must be a positive number or 0.") if(!e.JsUtil.isFiniteNumber(i))throw new TypeError("Last record must be a positive number.") if(i<=t)throw Error("Last record must be greater than first record.") this.firstVisibleRecord=t,this.lastVisibleRecord=i}},n.prototype.barsBetweenPoints=function(t,i){var r=this.dateScale.projection,n=0,o=this.primaryDataSeries(e.DataSeriesSuffix.CLOSE).length return 0=n?1:-1):0>=n&&r>=o?o:0>=r&&n>=o?-o:0),n},n.prototype.dateRange=function(e,t){var i=this.dateScale,r=i.projection if(!e&&!t)return i=i.projectionFrame,{startDate:r.dateByX(i.left),endDate:r.dateByX(i.right)} i=r.recordByX(r.xByDate(e,!1),!1),r=r.recordByX(r.xByDate(t,!1),!1),this.firstVisibleRecord=i,this.lastVisibleRecord=r-1},n.prototype.updateComputedDataSeries=function(){this.priceStyle.updateComputedDataSeries()},n.prototype.addCssClass=function(e){this.rootDiv.addClass(e)},n.prototype.removeCssClass=function(e){this.rootDiv.removeClass(e)},n}(e.EventableObject) e.Chart=r}(StockChartX||(StockChartX={})),function(e){jQuery.fn.StockChartX=function(t){return t=t||{},t.container=this,new e.Chart(t)}}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(e){var t=this this._maxChartsCountY=this._maxChartsCountX=1,this._chartsItems=[],this._displacement={width:2,height:20},this._isFullScreenMode=this._isFullWindowMode=!1,this._parent=e,$(window).resize(function(){return t.resizeCharts()}),$(window).on("scxFullScreenChange",this,function(e,i){return t._fullScreenChange(e,i)}),$(window).on("scxFullWindowChange",this,function(e,i){return t._fullWindowChange(e,i)})}return Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"toolbar",{get:function(){return this._toolbar},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"containerDisplacement",{get:function(){return this._displacement},set:function(e){this._displacement=e},enumerable:!0,configurable:!0}),t.prototype.addChart=function(){var t,i,r,n,o=this,a=this,s=$('
').appendTo(this._parent),l=s.StockChartX({width:0,height:0,showToolbar:!1}),c=l.keyboardEventsEnabled,h=l.mouseEventsEnabled return l.keyboardEventsEnabled=!1,l.mouseEventsEnabled=!1,l.on(e.ChartEvent.ENABLE_KEYBOARD_EVENTS_CHANGED+".chartsContainer",function(e){t=e.target,i=e.value}).on(e.ChartEvent.ENABLE_MOUSE_EVENTS_CHANGED+".chartsContainer",function(e){r=e.target,n=e.value}),this._toolbar||(this._toolbar=new e.UI.Toolbar({parent:this._parent.parent(),chart:l}),s.removeClass("scxNonActiveBorder"),s.addClass("scxActiveBorder"),l===t&&(c=i),c&&(l.keyboardEventsEnabled=!0),l===r&&(h=n),h&&(l.mouseEventsEnabled=!0)),s.mousedown(function(s){s=$(s.currentTarget) for(var l=0,c=o._chartsItems;l=n){for(var t=e._animations,o=0;o=r||this.verticalMoveEnabled&&Math.abs(n.y)>=r)&&(n=this._animation,this._state=e.GestureState.CONTINUED,!n.started)){var o=t.extend(!0,{},i) n.callback=function(){this._prevPoint=this._lastPoint,o.evt.which=this._which,this._invokeHandler(o)},n.start()}return!0}break case e.MouseEvent.UP:case e.MouseEvent.LEAVE:case e.TouchEvent.END:if(this.isActive())return this._animation.stop(),this._state=e.GestureState.FINISHED,this._invokeHandler(i),!0}return!1},r}(e.Gesture) e.PanGesture=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=jQuery,i=function(i){function r(t){i.call(this,t),this._lastScale=this._prevScale=this.delta=0,this._scaleThreshold=.005,this._animation=new e.Animation({context:this,recurring:!1})}return __extends(r,i),r.prototype.handleEvent=function(i){var n=i.evt,o=n.originalEvent switch(n.type){case e.MouseEvent.WHEEL:case e.MouseEvent.SCROLL:if(this._checkHit(i))return n.type===e.MouseEvent.SCROLL?this.delta=0o.wheelDelta?1:-1,this._state=e.GestureState.FINISHED,this._invokeHandler(i),!0 break case e.TouchEvent.START:if(!this.isActive()&&2===o.touches.length)return this._prevScale=this._lastScale=o.scale,(void 0!==this._prevScale||(this._prevScale=this._lastScale=r._calculateScale(o.touches),void 0!==this._prevScale))&&(this._state=e.GestureState.STARTED,!0) break case e.TouchEvent.MOVE:if(this.isActive()){if(void 0===(n=this._lastScale=o.scale)){if(o=o.touches,2!==o.length)return!0 n=this._lastScale=r._calculateScale(o)}if(o=n-this._prevScale,Math.abs(o)>=(0n||0>this._prevScale&&0o?1:-1,this._state=e.GestureState.CONTINUED,o=this._animation,!o.started)){var a=t.extend(!0,{},i) o.callback=function(){this._prevScale=this._lastScale,this._invokeHandler(a)},o.start()}return!0}break case e.TouchEvent.END:if(this.isActive())return this._state=e.GestureState.FINISHED,!0}return!1},r._calculateScale=function(e){var t=e[0].pageX-e[1].pageX return e=e[0].pageY-e[1].pageY,Math.sqrt(t*t+e*e)/Math.max(window.innerWidth,window.innerHeight)},r}(e.Gesture) e.MouseWheelGesture=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e),this._maxTouchOffset=10,this._maxTouchInterval=500,e&&(e.maxTouchOffset&&(this.maxTouchOffset=e.maxTouchOffset),e.maxTouchInterval&&(this.maxTouchInterval=e.maxTouchInterval))}return __extends(i,t),Object.defineProperty(i.prototype,"maxTouchOffset",{get:function(){return this._maxTouchOffset},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Max touch offset must be a number greater than 0.") this._maxTouchOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxTouchInterval",{get:function(){return this._maxTouchInterval},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Max touch interval must be a number greater than 0.") this._maxTouchInterval=t},enumerable:!0,configurable:!0}),i.prototype.handleEvent=function(t){switch(t.evt.type){case e.MouseEvent.CLICK:if(!this._isTouch&&this._finishGesture(t))return!0 break case e.TouchEvent.START:this._isTouch=!0,this._checkHit(t)&&(this._startPoint=t.pointerPosition,this._startDate=new Date,this._state=e.GestureState.STARTED) break case e.TouchEvent.END:if(this.isActive()){var i=Math.abs(t.pointerPosition.y-this._startPoint.y),r=new Date if(Math.abs(t.pointerPosition.x-this._startPoint.x)<=this._maxTouchOffset&&i<=this._maxTouchOffset&&r-this._startDate<=this._maxTouchInterval&&this._finishGesture(t))return!0 this._state=e.GestureState.NONE}}return!1},i.prototype._finishGesture=function(t){if(this._checkButton(t)&&this._checkHit(t))return this._state=e.GestureState.FINISHED,this._invokeHandler(t),!0},i}(e.Gesture) e.ClickGesture=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e),this._maxTouchOffset=10,this._maxTouchInterval=2500,e&&(e.maxTouchOffset&&(this.maxTouchOffset=e.maxTouchOffset),e.maxTouchInterval&&(this.maxTouchInterval=e.maxTouchInterval))}return __extends(i,t),Object.defineProperty(i.prototype,"maxTouchOffset",{get:function(){return this._maxTouchOffset},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Max touch offset must be a number greater than 0.") this._maxTouchOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxTouchInterval",{get:function(){return this._maxTouchInterval},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Max touch interval must be a number greater than 0.") this._maxTouchInterval=t},enumerable:!0,configurable:!0}),i.prototype.handleEvent=function(t){switch(t.evt.type){case e.MouseEvent.DOUBLE_CLICK:if(this._finishGesture(t))return!0 break case e.TouchEvent.START:if(this.isActive())return this._isSecondTouch=!0,!0 if(this._checkHit(t))return this._startPoint=t.pointerPosition,this._startDate=new Date,this._isSecondTouch=!1,this._state=e.GestureState.STARTED,!0 this._state=e.GestureState.NONE break case e.TouchEvent.END:if(this._isSecondTouch){var i=Math.abs(t.pointerPosition.y-this._startPoint.y),r=new Date if(Math.abs(t.pointerPosition.x-this._startPoint.x)<=this._maxTouchOffset&&i<=this._maxTouchOffset&&r-this._startDate<=this._maxTouchInterval){if(this._finishGesture(t))return!0}else this._state=e.GestureState.NONE}}return!1},i.prototype._finishGesture=function(t){return!(!this._checkButton(t)||!this._checkHit(t)||(this._state=e.GestureState.FINISHED,this._invokeHandler(t),t.stopPropagation=!0,0))},i}(e.Gesture) e.DoubleClickGesture=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e),this._maxTouchOffset=10,this._touchInterval=2e3,e&&(e.maxTouchOffset&&(this.maxTouchOffset=e.maxTouchOffset),e.touchInterval&&(this.touchInterval=e.touchInterval))}return __extends(i,t),Object.defineProperty(i.prototype,"maxTouchOffset",{get:function(){return this._maxTouchOffset},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Max touch offset must be a number greater than 0.") this._maxTouchOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"touchInterval",{get:function(){return this._touchInterval},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Touch interval must be a number greater than 0.") this._touchInterval=t},enumerable:!0,configurable:!0}),i.prototype.handleEvent=function(t){switch(t.evt.type){case e.MouseEvent.CONTEXT_MENU:if(this._isTouch=!1,this._finishGesture(t))return!0 break case e.TouchEvent.START:this._isTouch=!0,this._checkHit(t)&&(this._startPoint=t.pointerPosition,this._lastEvent=e.JsUtil.clone(t),this._state=e.GestureState.STARTED,this._startTimeout()) break case e.TouchEvent.MOVE:this.isActive()&&(this._lastEvent=e.JsUtil.clone(t)) break case e.TouchEvent.END:if(this._stopTimeout(),this._lastEvent)return this._lastEvent=null,t.stopPropagation=!0,!0}return!1},i.prototype._startTimeout=function(){var t=this this._timeoutId=setTimeout(function(){if(t.isActive()){var i=t._lastEvent,r=Math.abs(i.pointerPosition.y-t._startPoint.y) return!!(Math.abs(i.pointerPosition.x-t._startPoint.x)<=t._maxTouchOffset&&r<=t._maxTouchOffset&&t._finishGesture(i))||void(t._state=e.GestureState.NONE)}},this._touchInterval)},i.prototype._stopTimeout=function(){this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=null)},i.prototype._finishGesture=function(t){if(this._checkHit(t))return this._state=e.GestureState.FINISHED,this._invokeHandler(t),!0},i}(e.Gesture) e.ContextMenuGesture=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(e,t,i){if(this._gestures=[],e&&(this.add(e),t||i)){e=0 for(var r=this.gestures;e")[0].getContext("2d")),t},enumerable:!0,configurable:!0}),r.applyTextTheme=function(e){this.context.scxApplyTextTheme(e)},r.textWidth=function(e,t){var i=this.context return t&&i.scxApplyTextTheme(t),i.measureText(e).width},r.measureText=function(t,i){return{width:this.textWidth(t,i),height:e.HtmlUtil.getFontSize(i)+1}},r}() e.DummyCanvasContext=r}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(){}return e.calculateLinearRegression=function(e){for(var t=0,i=0,r=e.length,n=0;ne?(t=i[0].getTime()+e*this._dateScale.chart.timeInterval,new Date(t)):e>=i.length?(t=i[i.length-1].getTime()+(e-i.length+1)*this._dateScale.chart.timeInterval,new Date(t)):i[e]},e.prototype.recordByDate=function(e){var t=this._dateScale,i=t.getDateDataSeries() if(0===i.length)return-1 var r=i.floorIndex(e) return 0>r?(i=e.getTime()-i.firstValue.getTime(),r=Math.floor(i/t.chart.timeInterval)):r>=i.length&&(e=e.getTime()-i.lastValue.getTime(),r=i.length-1+Math.floor(e/t.chart.timeInterval)),r},e.prototype.dateByColumn=function(e){return e=this.recordByColumn(e),this.dateByRecord(e)},e.prototype.columnByDate=function(e){return e=this.xByDate(e,!1),this.columnByX(e)},e.prototype.dateByX=function(e){e=Math.round(e) var t=this.columnByX(e),i=this.xByColumn(t,!0,!1),r=this.dateByColumn(t) if(e===i)return r var t=e=e&&o<=t&&i++}return i},t.prototype.minMaxValues=function(e,t){var i=this._values;(null==e||0>e)&&(e=0),null==t&&(t=i.length-e) for(var r,n=Math.min(e+t-1,i.length-1),o={min:1/0,max:-1/0},a=e;a<=n;a++)null!=(r=i[a])&&(ro.max&&(o.max=r)) return o},t.prototype.floorIndex=function(e){var t=this.binaryIndexOf(e) if(0===t){var i=this._values if(0===i.length||i[0]>e)return-1}return 0<=t?t:~t},t.prototype.ceilIndex=function(e){return e=this.binaryIndexOf(e),0<=e?e:1+~e},t.prototype.binaryIndexOf=function(e){for(var t,i,r=this._values,n=0,o=r.length-1;n<=o;)if(t=(n+o)/2|0,(i=r[t])e))return t o=t-1}return~o},t.prototype.leftNearestVisibleValueIndex=function(e){var t=this._values for(e=Math.min(e,t.length-1);0<=e;e--)if(null!=t[e])return e return 0},t.prototype.rightNearestVisibleValueIndex=function(e){for(var t=this._values,i=t.length;e=i){for(var y=Math.trunc((y-m)/i),_=0;_=i){for(y=Math.trunc((t-y)/i),_=0;_o,S=y=P-i&&d[f]>c[f];f--)m=u[f] if(S)for(m=y,f=P-1;f>=P-i&&d[f]_){y=!0 break}var C=P?l[n]:c[n] if(C_?_+=Math.round((w-_)/i)*i:C<_-r&&(w=_-i,C=S-Math.round((S-C)/i)*i,1e-4S+r&&(C=S+i,w=_+Math.round((w-_)/i)*i,1e-4=t,y=0;y=i?(l.push(f),c.push(t),h.push(Math.max(t,v)),u.push(Math.min(t,v)),d.push(v),p.push(m),t=v,v=_,g=!g,f=null,m=0):(v=g?Math.max(v,_):Math.min(v,_),m+=a[0])}return r},t}() e.BarConverter=t}(StockChartX||(StockChartX={})),function(e){var t=function(){return function(){}}() e.Component=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){if(t.call(this),!(i.chart instanceof e.Chart))throw new TypeError("Invalid chart type.") this._chart=i.chart,this._subscribeEvents()}return __extends(i,t),Object.defineProperty(i.prototype,"chart",{get:function(){return this._chart},enumerable:!0,configurable:!0}),i.prototype._subscribeEvents=function(){},i.prototype._unsubscribeEvents=function(){},i.prototype.destroy=function(){this._unsubscribeEvents()},i}(e.Component) e.ChartComponent=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.call(this),this._gestures=this._initGestures()||new e.GestureArray}return __extends(i,t),i.prototype._initGestures=function(){return null},i.prototype.hitTest=function(e){return!1},i.prototype.layout=function(e){},i.prototype.handleEvent=function(e){return this._gestures.handleEvent(e)},i.prototype.draw=function(){},i.prototype.destroy=function(){},i}(e.Component) e.Control=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments),this._frame=new e.Rect}return __extends(i,t),Object.defineProperty(i.prototype,"rootDiv",{get:function(){return this._rootDiv},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"frame",{get:function(){return this._frame},enumerable:!0,configurable:!0}),i.prototype.hitTest=function(t){return e.Geometry.isPointInsideOrNearRect(t,this._frame)},i.prototype.layout=function(e){this._rootDiv||(this._rootDiv=this._createRootDiv()),this._rootDiv.scxFrame(e),this._frame.copyFrom(e)},i.prototype._createRootDiv=function(){return null},i.prototype.destroy=function(){this._rootDiv&&this._rootDiv.remove(),t.prototype.destroy.call(this)},i}(e.Control) e.FrameControl=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){if(t.call(this),!i)throw new TypeError("Config is not specified.") if(!(i.chart instanceof e.Chart))throw new TypeError("'config.chart' must be an instance of StockChartX.Chart.") this._chart=i.chart}return __extends(i,t),Object.defineProperty(i.prototype,"chart",{get:function(){return this._chart},enumerable:!0,configurable:!0}),i.prototype._subscribeEvents=function(){},i.prototype._unsubscribeEvents=function(){},i.prototype.destroy=function(){this._unsubscribeEvents(),t.prototype.destroy.call(this)},i}(e.FrameControl) e.ChartFrameControl=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.DateScaleScrollKind={NORMAL:"normal",AUTOSCALED:"autoscaled"},Object.freeze(e.DateScaleScrollKind),e.DateScaleZoomKind={NORMAL:"normal",AUTOSCALED:"autoscaled"},Object.freeze(e.DateScaleZoomKind),e.DateScaleZoomMode={PIN_CENTER:"pin_center",PIN_LEFT:"pin_left",PIN_RIGHT:"pin_right"},Object.freeze(e.DateScaleZoomMode) var t=function(t){function i(i){t.call(this,i),this._updateAnimation=new e.Animation({context:this,recurring:!1,callback:this._onUpdateAnimationCallback}),this._projectionFrame=new e.Rect,this._columnWidth=0,this._formatter=new e.TimeIntervalDateTimeFormat,this._moreHistoryRequested=!1,this._projection=new e.Projection(this),this._topPanel=new e.DateScalePanel({dateScale:this,cssClass:"scxTopDateScale",visible:!1}),this._bottomPanel=new e.DateScalePanel({dateScale:this,cssClass:"scxBottomDateScale"}),this.loadState(i)}return __extends(i,t),Object.defineProperty(i.prototype,"topPanel",{get:function(){return this._topPanel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bottomPanel",{get:function(){return this._bottomPanel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"topPanelCssClass",{get:function(){return"scxTopDateScale"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bottomPanelCssClass",{get:function(){return"scxBottomDateScale"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"topPanelVisible",{get:function(){return this._topPanel.visible},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bottomPanelVisible",{get:function(){return this._bottomPanel.visible},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"projection",{get:function(){return this._projection},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"projectionFrame",{get:function(){return this._projectionFrame},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"calibrator",{get:function(){return this._calibrator},set:function(e){this._calibrator=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"firstVisibleIndex",{get:function(){return this._firstVisibleIndex},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastVisibleIndex",{get:function(){return this._lastVisibleIndex},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"firstVisibleRecord",{get:function(){return this._options.firstVisibleRecord},set:function(t){this.allowPartialRecords||(t=Math.trunc(t)) var i=this._options.firstVisibleRecord i!==t&&(this._options.firstVisibleRecord=t,this._firstVisibleIndex=Math.floor(t),this.chart.fireValueChanged(e.ChartEvent.FIRST_VISIBLE_RECORD_CHANGED,i,t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastVisibleRecord",{get:function(){return this._options.lastVisibleRecord},set:function(t){this.allowPartialRecords||(t=Math.trunc(t)) var i=this._options.lastVisibleRecord i!==t&&(this._options.lastVisibleRecord=t,this._lastVisibleIndex=Math.ceil(t),this.chart.fireValueChanged(e.ChartEvent.LAST_VISIBLE_RECORD_CHANGED,i,t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visibleDateRange",{get:function(){var e=this.projectionFrame return{min:this.projection.dateByX(e.left),max:this.projection.dateByX(e.right)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"useManualHeight",{get:function(){return this._options.useManualHeight},set:function(e){this._options.useManualHeight=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"manualHeight",{get:function(){return this._options.height},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Height must be a positive number.") this._options.height=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minVisibleRecords",{get:function(){return this._options.minVisibleRecords},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Records must be a finite number greater than 0.") this._options.minVisibleRecords=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rightAdditionalSpaceRatio",{get:function(){return this._options.rightAdditionalSpaceRatio},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw new TypeError("Ratio must be a positive number.") this._options.rightAdditionalSpaceRatio=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollKind",{get:function(){return this._options.scrollKind},set:function(e){this._options.scrollKind=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"zoomKind",{get:function(){return this._options.zoomKind},set:function(e){this._options.zoomKind=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"zoomMode",{get:function(){return this._options.zoomMode},set:function(e){this._options.zoomMode=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"theme",{get:function(){return this._options.theme},set:function(t){var i=this._options.theme this._options.theme=t,this.chart.fireValueChanged(e.ChartEvent.DATE_SCALE_THEME_CHANGED,i,t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"actualTheme",{get:function(){return this._options.theme||this.chart.theme.dateScale},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"columnsCount",{get:function(){return this.needsAutoScale()?0:this._options.lastVisibleRecord-this._options.firstVisibleRecord+1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"columnWidth",{get:function(){return this._columnWidth},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxAllowedRecord",{get:function(){var e=this._projectionFrame.width*this.rightAdditionalSpaceRatio/this._columnWidth return this.getDateDataSeries().length-1+e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"majorTickMarkLength",{get:function(){return this._options.majorTickMarkLength},set:function(e){this._options.majorTickMarkLength=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minorTickMarkLength",{get:function(){return this._options.minorTickMarkLength},set:function(e){this._options.minorTickMarkLength=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textPadding",{get:function(){return this._options.textPadding},set:function(e){this._options.textPadding=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"allowPartialRecords",{get:function(){return this._options.allowPartialRecords},set:function(e){this._options.allowPartialRecords!==e&&(this._options.allowPartialRecords=e,this.firstVisibleRecord=this.firstVisibleRecord,this.lastVisibleRecord=this.lastVisibleRecord)},enumerable:!0,configurable:!0}),i.prototype._subscribeEvents=function(){var t=this this.chart.on(e.ChartEvent.LOCALE_CHANGED+".scxDateScale",function(e){t._formatter.locale=e.value})},i.prototype._unsubscribeEvents=function(){this.chart.off(".scxDateScale")},i.prototype._calculateProjectionMetrics=function(){this._columnWidth=this._projectionFrame.width/this.columnsCount},i.prototype.setNeedsAutoScale=function(){this.lastVisibleRecord=this.firstVisibleRecord=null},i.prototype.needsAutoScale=function(){return null==this.firstVisibleRecord||null==this.lastVisibleRecord},i.prototype.autoScale=function(){var e=this.chart.recordCount this.firstVisibleRecord=0Math.abs(e))return!1 var t=Math.abs(e)/this.columnWidth return this.allowPartialRecords||(t=Math.ceil(t)),this.scrollOnRecords(0<=e?t:-t)},i.prototype.scrollOnRecords=function(e){if(0===e)return!1 var t=this.firstVisibleRecord,i=this.lastVisibleRecord,r=t-e return e=i-e,this.allowPartialRecords||(r=Math.round(r),e=Math.round(e)),!!(this.canSetVisibleRecord(r)&&this.canSetVisibleRecord(e)||!(0<=r)&&(r=0,e=i-t,this.canSetVisibleRecord(r)&&this.canSetVisibleRecord(e)))&&(this.firstVisibleRecord=r,this.lastVisibleRecord=e,this._requestMoreHistoryIfNeed(),!0)},i.prototype.zoomOnPixels=function(e,t){if(null==t&&(t=e),!isFinite(e)||!isFinite(t))throw Error("Pixels must be a finite number.") if(3>Math.abs(e)&&3>Math.abs(t))return!1 var i=this.columnWidth,r=Math.abs(e)/i,i=Math.abs(t)/i return this.allowPartialRecords||(r=Math.ceil(r),i=Math.ceil(i)),this.zoomOnRecords(0o&&(n=o=Math.max(o,r)),this.canSetVisibleRecord(n)||(n=0),this.canSetVisibleRecord(o)||(o=this.maxAllowedRecord) var a=n!==i||o!==r if(a){var s=o-n+1 if(s=this.getDateDataSeries().length)return!1 this.firstVisibleRecord=n,this.lastVisibleRecord=o,this._requestMoreHistoryIfNeed()}return a},i.prototype._handleZoom=function(t){switch(this.zoomMode){case e.DateScaleZoomMode.PIN_CENTER:this.zoomOnPixels(t) break case e.DateScaleZoomMode.PIN_LEFT:this.zoomOnPixels(0,t) break case e.DateScaleZoomMode.PIN_RIGHT:this.zoomOnPixels(t,0) break default:throw Error("Unknown zoom mode: "+this.zoomMode)}t=!1,this.zoomKind===e.DateScaleZoomKind.AUTOSCALED&&(t=!0),this.chart.setNeedsUpdate(t)},i.prototype._requestMoreHistoryIfNeed=function(){var t=this.chart 0=n.right)break var g=m.length*t,y=v-g/2 if(yc&&(u=c,y=u-g,d="right"),this.majorTicks.push({x:v,textX:u,textAlign:d,date:r,text:m}),p=y+g+l,v=Math.ceil(p),u=r,d=m)),v>n.right)break r=o.recordByX(v)+1,a=r>a?r:a+1}}else a++}},i.prototype._labelDateString=function(t,i){if(t<=i)return null var r=e.TimeSpan,n=this._formatter,o=n.timeInterval,a=t.getFullYear(),s=i.getFullYear() if(o>=r.MILLISECONDS_IN_YEAR)return a!==s?a.toString():null var l=e.DateTimeFormatName,c=t.getMonth()+1,h=i.getMonth()+1 if(o>=r.MILLISECONDS_IN_MONTH)return a!==s?n.formatWithFormatter(t,l.YEAR_MONTH):c!==h?n.formatWithFormatter(t,l.YEAR_MONTH):null var u=t.getDate(),d=i.getDate() if(o>=r.MILLISECONDS_IN_DAY)return a!==s?n.formatWithFormatter(t,l.DATE):c!==h||u!==d?n.formatWithFormatter(t,l.MONTH_DAY):null var p=t.getHours(),f=i.getHours(),m=t.getMinutes(),v=i.getMinutes() if(o>=r.MILLISECONDS_IN_MINUTE)return a!==s?n.formatWithFormatter(t,l.SHORT_DATE_TIME):c!==h||u!==d?n.formatWithFormatter(t,l.SHORT_DATE_TIME):p!==f||m!==v?n.formatWithFormatter(t,l.SHORT_TIME):null var g=t.getSeconds(),y=i.getSeconds() return o>=r.MILLISECONDS_IN_SECOND?a!==s?n.formatWithFormatter(t,l.SHORT_DATE_TIME):c!==h||u!==d?n.formatWithFormatter(t,l.SHORT_DATE_TIME):p!==f||m!==v?n.formatWithFormatter(t,l.LONG_TIME):g!==y?n.formatWithFormatter(t,l.LONG_TIME):null:(r=t.getMilliseconds(),o=i.getMilliseconds(),a!==s?n.formatWithFormatter(t,l.LONG_DATE_TIME):c!==h||u!==d?n.formatWithFormatter(t,l.LONG_DATE_TIME):p!==f||m!==v?n.formatWithFormatter(t,l.LONG_TIME):g!==y||r!==o?n.formatWithFormatter(t,l.LONG_TIME):null)},i.defaults={majorTicks:{minOffset:30},minorTicks:{count:0}},i}(e.DateScaleCalibrator) e.AutoDateScaleCalibrator=t,e.DateScaleCalibrator.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){t.call(this,i),this._formatter=new e.CustomDateTimeFormat}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.FixedDateScaleCalibrator"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"majorTicksCount",{get:function(){var e=this._options.majorTicks return e&&null!=e.count?e.count:i.defaults.majorTicks.count},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Ticks count must be a positive number.") var i=this._options;(i.majorTicks||(i.majorTicks={})).count=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minorTicksCount",{get:function(){var e=this._options.minorTicks return e&&null!=e.count?e.count:i.defaults.minorTicks.count},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Ticks count must be a positive number.") var i=this._options;(i.minorTicks||(i.minorTicks={})).count=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"majorTicksFormat",{get:function(){var e=this._options.majorTicks return e&&e.format||i.defaults.majorTicks.format},set:function(e){var t=this._options;(t.majorTicks||(t.majorTicks={})).format=e},enumerable:!0,configurable:!0}),i.prototype.calibrate=function(e){t.prototype.calibrate.call(this,e),this._calibrateMajorTicks(e),this._calibrateMinorTicks(this.minorTicksCount)},i.prototype._calibrateMajorTicks=function(t){var r=t.projectionFrame,n=t._textDrawBounds(),o=n.left,n=n.left+n.width,a=t.projection,s=t.chart.chartPanelsContainer.panelPadding,l=r.left-s.left,c=e.DummyCanvasContext,h=this.majorTicksCount,r=(r.right+s.right-l)/(h-1) for((s=this.majorTicksFormat)||(s={}),s.other||(s.other=i._createAutoFormat(t.chart)),c.applyTextTheme(t.actualTheme.text),t=0;tn&&(m="right"),this.majorTicks.push({x:u,textX:u,textAlign:m,date:d,text:p})}},i.prototype._updateFormatterForLabel=function(e,t,i){this._formatter.formatString=t?i.last||i.other:0===e?i.first||i.other:i.other},i._createAutoFormat=function(t){return t=t.timeInterval,t>=e.TimeSpan.MILLISECONDS_IN_YEAR?"YYYY":t>=e.TimeSpan.MILLISECONDS_IN_MONTH?"YYYY MMM":t>=e.TimeSpan.MILLISECONDS_IN_DAY?"YYYY-MM-DD":t>=e.TimeSpan.MILLISECONDS_IN_MINUTE?"YYYY-MM-DD HH:mm":t>=e.TimeSpan.MILLISECONDS_IN_SECOND?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm:ss.SSS"},i.defaults={majorTicks:{count:3},minorTicks:{count:0}},i}(e.DateScaleCalibrator) e.FixedDateScaleCalibrator=t,e.DateScaleCalibrator.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=jQuery,i=function(i){function r(t){i.call(this,t),this._options=null,this._leftPanel=new e.ValueScalePanel({valueScale:this,cssClass:"scxLeftValueScale"}),this._rightPanel=new e.ValueScalePanel({valueScale:this,cssClass:"scxRightValueScale"}),this.loadState(t)}return __extends(r,i),Object.defineProperty(r.prototype,"leftPanel",{get:function(){return this._leftPanel},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"rightPanel",{get:function(){return this._rightPanel},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"leftPanelCssClass",{get:function(){return"scxLeftValueScale"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"rightPanelCssClass",{get:function(){return"scxRightValueScale"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"useManualWidth",{get:function(){return this._options.useManualWidth},set:function(e){this._options.useManualWidth=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"manualWidth",{get:function(){return this._options.width},set:function(t){if(!e.JsUtil.isFiniteNumber(t)||0>=t)throw Error("Width must be greater than 0.") this._options.width=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"leftPanelVisible",{get:function(){return this._options.showLeftPanel},set:function(e){this._leftPanel.visible=this._options.showLeftPanel=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"rightPanelVisible",{get:function(){return this._options.showRightPanel},set:function(e){this._rightPanel.visible=this._options.showRightPanel=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"index",{get:function(){return this.chart.valueScales.indexOf(this)},enumerable:!0,configurable:!0}),r.prototype.saveState=function(){return t.extend(!0,{},this._options)},r.prototype.loadState=function(e){e=e||{},this._options={},this.leftPanelVisible=void 0!==e.showLeftPanel&&!!e.showLeftPanel,this.rightPanelVisible=void 0===e.showRightPanel||!!e.showRightPanel,this.manualWidth=e.width||100,this.useManualWidth=void 0!==e.useManualWidth&&!!e.useManualWidth},r.prototype.layout=function(e){var t=this._leftPanel.layout(e,!0),i=this._rightPanel.layout(e,!1) return e=e.clone(),t&&e.cropLeft(t),i&&e.cropRight(i),e},r.prototype.draw=function(){},r.prototype.destroy=function(){this.leftPanel.destroy(),this.rightPanel.destroy(),i.prototype.destroy.call(this)},r}(e.ChartComponent) e.ValueScale=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){var r=this if(t.call(this),this._isVisible=!0,!i)throw Error("Config is not specified.") if(!(i.valueScale instanceof e.ValueScale))throw new TypeError("Config.valueScale must be an instance of StockChartX.ValueScale") if(this._valueScale=i.valueScale,!i.cssClass)throw Error("'config.cssClass' is not specified.") this._cssClass=i.cssClass,this._isVisible=null==i.visible||!!i.visible,this.chart.on(e.ChartEvent.THEME_CHANGED+".scxValueScalePanel",function(){r.applyTheme()})}return __extends(i,t),Object.defineProperty(i.prototype,"valueScale",{get:function(){return this._valueScale},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cssClass",{get:function(){return this._cssClass},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._isVisible},set:function(e){this._isVisible=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chart",{get:function(){return this._valueScale&&this._valueScale.chart},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"size",{get:function(){var e=this.rootDiv return e&&e.scxSize()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"contentSize",{get:function(){var e=this.rootDiv return e&&e.scxContentSize()},enumerable:!0,configurable:!0}),i.prototype.layout=function(e,t){var i=this.rootDiv,r=null return this._isVisible?(i||(this._rootDiv=i=this.chart.chartPanelsContainer.rootDiv.scxAppend("div","scxValueScale").addClass(this._cssClass),this.applyTheme()),i.width(this.getWidth()).outerHeight(e.height),r=this.frame,r.width=i.outerWidth(),r.left=t?e.left:e.right-r.width,r.height=e.height,i.css("left",r.left)):i&&(i.remove(),this._rootDiv=null),r},i.prototype.getWidth=function(){var e=this._valueScale if(e.useManualWidth)return e.manualWidth for(var t=e=0,i=this.chart.chartPanels;tt)throw Error("Interval is too small.")}var i=this._options;(i.majorTicks||(i.majorTicks={})).interval=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minValuesOffset",{get:function(){var e=this._options.majorTicks return e&&null!=e.minOffset?e.minOffset:i.defaults.majorTicks.minOffset},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Values offset must be a value greater or equal to 0.") var i=this._options;(i.majorTicks||(i.majorTicks={})).minOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minorTicksCount",{get:function(){var e=this._options.minorTicks return e&&null!=e.count?e.count:i.defaults.minorTicks.count},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Tick count must be greater or equal to 0.") var i=this._options;(i.minorTicks||(i.minorTicks={})).count=t},enumerable:!0,configurable:!0}),i.prototype.calibrate=function(e){t.prototype.calibrate.call(this,e),this._calibrateIntervalMajorTicks(e),1>=this.majorTicks.length&&(this.majorTicks.length=0,this._calibrateRangeMajorTicks(e)),this._calibrateMinorTicks(this.minorTicksCount)},i.prototype._calibrateIntervalMajorTicks=function(t){var i=this.interval if(!(1e-8>i||t.maxVisibleValue-t.minVisibleValue<=i))for(var r,n=e.HtmlUtil.getFontSize(t.actualTheme.text),o=n+this.minValuesOffset,a=t.padding,s=t.chartPanel.layer.size.height-a.bottom-n/2,l=t.projection,c=l.valueByY(0),a=n=Math.round(a.top+n/2),h=null;n=c&&(r=c-i),c=r,(n=Math.round(l.yByValue(r)))>=a)break u=n=u+1}while(n=s)break u=t.formatValue(r),u!==h&&(this.majorTicks.push({y:n,value:r,text:u}),h=u),n=a}},i.prototype._calibrateRangeMajorTicks=function(t){var i=e.HtmlUtil.getFontSize(t.actualTheme.text),r=i/2,n=t.padding,o=t.chartPanel.layer.size.height,a=n.top+r,r=o-n.bottom-r,n=t.projection r-a=a.minHeightRatio?a.heightRatio=s:this._adjustHeightRatiosToEncloseNewRatio(o)}else this._adjustHeightRatiosToEncloseNewRatio(o)}catch(e){if(!(0<(r=this._availableHeightRatio())&&r>=i.minHeightRatio))throw e i.heightRatio=r}return null==t?n.push(i):n.splice(t,0,i),this._updateSplitters(),this.chart.fireValueChanged(e.ChartEvent.PANEL_ADDED,i),i},r.prototype.removePanel=function(t){t="number"==typeof t?this._panels[t]:t var i=this.chart,r=i.mainPanel if(t===r)throw Error("Main panel cannot be removed.") for(var n=this._panels,o=0;o=n.top&&e<=n.bottom)return r}return null},r.prototype.setPanelHeightRatio=function(e,t){var i=this.chart.mainPanel if(e===i)e.heightRatio=t else{var r=e.heightRatio e.heightRatio=t,i.heightRatio-=e.heightRatio-r}},r.prototype._availableHeightRatio=function(){return 1-this._panels.reduce(function(e,t){return e+t.heightRatio},0)},r.prototype._adjustHeightRatiosToEncloseNewRatio=function(e){for(var t=this._panels,i=t.map(function(e){return e.heightRatio});;){var r=e-this._availableHeightRatio() if(1e-5>=r)break for(var n=!1,o=0,a=t;o=s.minHeightRatio&&(s.heightRatio=l,n=!0)}if(!n){for(e=0;e=i.length)?new e.ChartPanelSplitter:i[n] a.setPanels(n,t[n],t[n+1]),o&&i.push(a)}},r.prototype.saveState=function(){var t=e.JsUtil.clone(this._options) t.panels=[] for(var i=0,r=this._panels;ithis._options.maxHeightRatio)throw Error("Height ratio must be a number in range [minHeightRatio..maxHeightRatio]") this._options.heightRatio=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minHeightRatio",{get:function(){return this._options.minHeightRatio},set:function(t){if(!e.JsUtil.isFiniteNumber(t)||0>t||t>this._options.maxHeightRatio)throw Error("Min height ratio must be a number in range [0..maxHeightRatio].") this._options.minHeightRatio=t,this._options.heightRatiot&&(this._options.heightRatio=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"moveDirection",{get:function(){return this._options.moveDirection},set:function(e){this._options.moveDirection=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"moveKind",{get:function(){return this._options.moveKind},set:function(e){this._options.moveKind=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"xGridVisible",{get:function(){return this._options.showXGrid},set:function(t){t=!!t var i=this._options.showXGrid i!==t&&(this._options.showXGrid=t,this._fire(e.PanelEvent.X_GRID_VISIBLE_CHANGED,t,i))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"yGridVisible",{get:function(){return this._options.showYGrid},set:function(t){t=!!t var i=this._options.showYGrid i!==t&&(this._options.showYGrid=t,this._fire(e.PanelEvent.Y_GRID_VISIBLE_CHANGED,t,i))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"plots",{get:function(){return this._plots},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"drawings",{get:function(){return this._drawings},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"theme",{get:function(){return this._options.theme},set:function(t){var i=this._options.theme this._options.theme=t,this._fire(e.PanelEvent.THEME_CHANGED,t,i)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"actualTheme",{get:function(){return this._options.theme||this.chart.theme.chartPanel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"projection",{get:function(){return this.valueScale.projection},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"titleDiv",{get:function(){return this._controls.title},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"indicators",{get:function(){var e=this return this.chart.indicators.filter(function(t){return t.chartPanel===e})},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"contentFrame",{get:function(){return this._contentFrame},enumerable:!0,configurable:!0}),i.prototype._fire=function(e,t,i){var r=this.chart r&&r.fireTargetValueChanged(this,e,t,i)},i.prototype.getIndex=function(){return this._panelsContainer.panels.indexOf(this)},i.prototype.getProjection=function(e){return this.valueScales[e?e.index:0].projection},i.prototype.getValueScale=function(e){return this.valueScales[e?e.index:0]},i.prototype.setHeightRatio=function(e){this._panelsContainer.setPanelHeightRatio(this,e)},i.prototype.setNeedsAutoScale=function(){for(var e=0,t=this._valueScales;en&&(n=s.max))}return isFinite(r)||(r=-1),isFinite(n)||(n=1),r===n&&(r--,n++),{min:r,max:n}},i.prototype.autoScaledMinMaxValues=function(e){var t=this.chart.dateScale,i=t.firstVisibleIndex return this.minMaxValues(i,t.lastVisibleIndex-i+1,e)},i.prototype.formatValue=function(e){return this.valueScale.formatValue(e)},i.prototype.hitTest=function(e){return this._contentFrame.containsPoint(e)},i.prototype.saveState=function(){for(var t={options:e.JsUtil.clone(this._options),valueScales:[]},i=0,r=this._valueScales;i=r)){null==t&&(t=this.chart.hoveredRecord),(null==t||0>t||t>=r||isNaN(t))&&(t=r-1) var r=this._barInfoControls,n=i.open.valueAtIndex(t),o=i.close.valueAtIndex(t),a=this.chart.theme,s=a.plot.bar.candle,s=(o>=n?s.upCandle:s.downCandle).fill.fillColor,l=this.chart.dateScale.formatDate(i.date.valueAtIndex(t)) r.date.text(l),r.open.text(this.formatValue(n)).css("color",s),r.high.text(this.formatValue(i.high.valueAtIndex(t))).css("color",s),r.low.text(this.formatValue(i.low.valueAtIndex(t))).css("color",s),r.close.text(this.formatValue(o)).css("color",s),e.Environment.isMobile||e.Environment.isPhone||!this._titleNeedsUpdate||(t=e.DummyCanvasContext.textWidth(l,a.valueScale.text)+15,i=r.date.width(),(i1.3*t)&&r.date.width("auto").width(t),this._titleNeedsUpdate=!1)}}},i.prototype._subscribeEvents=function(){var t=this,i=this.chart i.on(e.ChartEvent.THEME_CHANGED+".scxPanel",function(){t._applyTheme()},this),i.mainPanel===this&&(i.on(e.ChartEvent.HOVER_RECORD_CHANGED+".scxPanel",function(e){t.updateHoverRecord(e.value)},this),i.on(e.ChartEvent.INSTRUMENT_CHANGED+".scxPanel",function(){t._updateWatermark(),t._updateInstrument()},this)),i.on(e.ChartEvent.VALUE_SCALE_ADDED+".scxPanel",function(){t._valueScales.push(new e.ChartPanelValueScale({chartPanel:t}))},this),i.on(e.ChartEvent.VALUE_SCALE_REMOVED+".scxPanel",function(e){t._valueScales.splice(e.value,1)},this),i.on(e.ChartEvent.PRICE_STYLE_CHANGED+".scxPanel",function(e){t._barInfoControls&&(t._barInfoControls.series=t.chart.primaryBarDataSeries())},this)},i.prototype._unSubscribeEvents=function(){var t=this.chart t&&t.off(e.ChartEvent.THEME_CHANGED+".scxPanel",this).off(e.ChartEvent.HOVER_RECORD_CHANGED+".scxPanel",this).off(e.ChartEvent.VALUE_SCALE_ADDED+".scxPanel",this).off(e.ChartEvent.VALUE_SCALE_REMOVED+".scxPanel",this)},i.prototype._initGestures=function(){return new e.GestureArray([new e.PanGesture({handler:this._handlePanGesture,hitTest:this._panGestureHitTest}),new e.MouseWheelGesture({handler:this._handleMouseWheel,hitTest:this.hitTest}),new e.ClickGesture({handler:this._handleClickGesture,hitTest:this.hitTest}),new e.DoubleClickGesture({handler:this._handleDoubleClickGesture,hitTest:this.hitTest})],this)},i.prototype._panGestureHitTest=function(t){return this.moveDirection!==e.PanelMoveDirection.NONE&&this.hitTest(t)},i.prototype._handlePanGesture=function(t){var i=this.chart switch(t.state){case e.GestureState.STARTED:i.rootDiv.addClass("scxPanelScroll") break case e.GestureState.FINISHED:i.rootDiv.removeClass("scxPanelScroll") break case e.GestureState.CONTINUED:t=t.moveOffset var r,n switch(this.moveDirection){case e.PanelMoveDirection.HORIZONTAL:i.dateScale.scrollOnPixels(t.x)&&(t=this.moveKind===e.PanelMoveKind.AUTOSCALED,i.setNeedsUpdate(t)) break case e.PanelMoveDirection.VERTICAL:for(r=0,n=this.valueScales;rt)throw Error("Ratio must be greater or equal to 1.") this._options.maxValueRangeRatio=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"theme",{get:function(){return this._options.theme},set:function(e){this._options.theme=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"majorTickMarkLength",{get:function(){return this._options.majorTickMarkLength},set:function(e){this._options.majorTickMarkLength=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minorTickMarkLength",{get:function(){return this._options.minorTickMarkLength},set:function(e){this._options.minorTickMarkLength=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"projection",{get:function(){return this._projection},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"padding",{get:function(){return this._options.padding},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"calibrator",{get:function(){return this._calibrator},set:function(e){this._calibrator=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"actualTheme",{get:function(){return this._options.theme||this.chart.theme.valueScale},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chartValueScale",{get:function(){var e=this._index() return 0<=e?this.chart.valueScales[e]:null},enumerable:!0,configurable:!0}),i.prototype._initGestures=function(){return new e.GestureArray([new e.DoubleClickGesture({handler:this._handleDoubleClickGesture}),new e.PanGesture({handler:this._handlePanGesture,horizontalMoveEnabled:!1}),new e.MouseWheelGesture({handler:this._handleMouseWheelGesture})],this,this.hitTest)},i.prototype._updateFormatter=function(){var t=this.chart.locale,i=this.formatter i?i.locale=t:this.formatter=new e.IntlNumberFormat(t,{minimumFractionDigits:3,maximumFractionDigits:3})},i.prototype._setMinVisibleValue=function(e){this._options.minVisibleValue=e},i.prototype._setMaxVisibleValue=function(e){this._options.maxVisibleValue=e},i.prototype._index=function(){for(var e=this._panel.valueScales,t=0;tr&&(r=s.max))}isFinite(e)||(e=-1),isFinite(r)||(r=1),e===r&&(e--,r++),(t=this.range)&&(null!=t.min&&e>t.min&&(e=t.min),null!=t.max&&ri.min&&(t=i.min),null!=i.max&&en.min&&(r=n.min),null!=n.max&&ethis.maxVisibleValue-this.minVisibleValue&&this.autoScale(),e=this._projectionFrame,e.left=0,e.top=0,e.width=this._panel.layer.size.width,e.height=this._panel.layer.size.height,e.applyPadding(this._panel.chartPanelsContainer.panelPadding),this._calibrator.calibrate(this),this._layoutContentFrames()},i.prototype._layoutContentFrames=function(){var t=this._panel,i=this.chartValueScale,r=i.rightPanelVisible,n=this._options.padding if(i.leftPanelVisible){var o=i.leftPanel,a=parseFloat(o.rootDiv.css("border-left-width")),s=parseFloat(t.rootDiv.css("border-left-width")),l=o.contentSize.width,c=Math.round(Math.max(a-s,0));(o=this._leftFrame)||(o=this._leftFrame=new e.Rect),o.left=c,o.top=0,o.width=l-Math.max(s-a),o.height=t.rootDiv.height(),(a=this._leftContentFrame)||(a=this._leftContentFrame=new e.Rect),a.left=o.left+n.right,a.top=o.top,a.width=o.width-n.left-n.right,a.height=o.height}else this._leftFrame=this._leftContentFrame=null r?(r=i.rightPanel,a=parseFloat(r.rootDiv.css("border-left-width")),i=r.contentSize.width,a=r.frame.left+a,(r=this._rightFrame)||(r=this._rightFrame=new e.Rect),r.left=a,r.top=0,r.width=i,r.height=t.rootDiv.height(),(t=this._rightContentFrame)||(t=this._rightContentFrame=new e.Rect),t.left=r.left+n.left,t.top=r.top,t.width=r.width-n.left-n.right,t.height=r.height):this._rightFrame=this._rightContentFrame=null},i.prototype.clip=function(){var e=this._leftFrame,t=this._rightFrame if(!e&&!t)return!1 var i=this._panel.layer.context return e&&i.rect(e.left,e.top,e.width,e.height),t&&i.rect(t.left,t.top,t.width,t.height),i.clip(),!0},i.prototype.draw=function(){var e=this._panel.layer.context if(e.save(),this.clip()){var t=this.actualTheme,i=this._leftContentFrame,r=this._rightContentFrame,n=this._leftFrame,o=this._rightFrame,a=n&&n.right-1,s=this.majorTickMarkLength,l=this.minorTickMarkLength e.scxApplyTextTheme(t.text),e.textBaseline="middle",e.beginPath() for(var c=0,h=this.calibrator.majorTicks;ci)return!1 var r=this.minAllowedValue if(!isNaN(r)&&er)return!1 var n,r=this._panel.autoScaledMinMaxValues(this.chartValueScale),o=this.minAllowedValueRatio,a=this.maxAllowedValueRatio return!(!isNaN(o)&&(n=(r.min-e)/i)>o||!isNaN(a)&&(n=(t-r.max)/i)>a)&&(o=this.minValueRangeRatio,n=(r.max-r.min)/i,!(!isNaN(o)&&no)))},i}(e.Control) e.ChartPanelValueScale=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments),this._index=null,this._needsSetTheme=this._isMoving=!1}return __extends(i,t),Object.defineProperty(i.prototype,"topPanel",{get:function(){return this._topPanel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bottomPanel",{get:function(){return this._bottomPanel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chart",{get:function(){return this._topPanel&&this._topPanel.chart},enumerable:!0,configurable:!0}),i.getHeight=function(){return 1},i.prototype._initGestures=function(){return new e.GestureArray([new e.MouseHoverGesture({handler:this._handleMouseHoverGesture,hoverEventEnabled:!1}),new e.PanGesture({handler:this._handlePanGesture,horizontalMoveEnabled:!1})],this,this.hitTest)},i.prototype._handlePanGesture=function(t){if(this.chart.state!==e.ChartState.ZOOM_IN)switch(t.state){case e.GestureState.STARTED:this._isMoving=!0,this.chart.state=e.ChartState.RESIZING_PANELS,this._startMove() break case e.GestureState.CONTINUED:this.move(t.moveOffset.y)&&this.chart.updateSplitter(this) break case e.GestureState.FINISHED:this._isMoving=!1,this.chart.state=e.ChartState.NORMAL}},i.prototype._handleMouseHoverGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:this._startMove() break case e.GestureState.FINISHED:this._stopMove(),this.chart.crossHair.setPosition(i.pointerPosition)}},i.prototype._startMove=function(){this.chart.rootDiv.addClass("scxSplitterMove"),this.rootDiv.addClass("scxHover"),this._applyTheme(!0),this.chart.crossHair.hide()},i.prototype._stopMove=function(){this.chart.rootDiv.removeClass("scxSplitterMove"),this.rootDiv.removeClass("scxHover"),this._applyTheme(!1),this.chart.crossHair.show()},i.prototype.setPanels=function(e,t,i){this._index=e,this._topPanel=t,this._bottomPanel=i},i.prototype.invalidateTheme=function(){this._needsSetTheme=!1},i.prototype._applyTheme=function(e){var t=this.chart.theme.splitter this.rootDiv.css("background-color",e?t.hoverFillColor:t.fillColor),this._needsSetTheme=!0},i.prototype.move=function(e){if(0===e)return!1 var t=this._topPanel,i=this._bottomPanel e=t.frame.height+e var r=t.chart.chartPanelsContainer.totalPanelsHeight() return e/=r,r=i.heightRatio+(t.heightRatio-e),!(et.maxHeightRatio||ri.maxHeightRatio||(t.heightRatio=e,i.heightRatio=r,0))},i.prototype.hitTest=function(e){return!!this._isMoving||t.prototype.hitTest.call(this,e)},i.prototype._createRootDiv=function(){return this.chart.chartPanelsContainer.rootDiv.scxAppend("div","scxPanelSplitter")},i.prototype.layout=function(e){t.prototype.layout.call(this,e),this.frame.top+=this._topPanel.chartPanelsContainer.frame.top,this._needsSetTheme||this._applyTheme(!1)},i}(e.FrameControl) e.ChartPanelSplitter=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.PlotType={INDICATOR:"indicator",PRICE_STYLE:"priceStyle",USER:"user"},Object.freeze(e.PlotType) var t !function(e){e.DATA_SERIES_CHANGED="plotDataSeriesChanged",e.PANEL_CHANGED="plotPanelChanged",e.THEME_CHANGED="plotThemeChanged",e.STYLE_CHANGED="plotStyleChanged",e.SHOW_VALUE_MARKERS_CHANGED="plotShowValueMarkersChanged",e.SHOW_VALUE_LINES_CHANGED="plotShowValueLinesChanged",e.EXTEND_VALUE_LINES_CHANGED="plotExtendValueLinesChanged",e.VISIBLE_CHANGED="plotVisibleChanged",e.VALUE_SCALE_CHANGED="plotValueScaleChanged",e.BASE_VALUE_CHANGED="plotBaseValueChanged"}(t=e.PlotEvent||(e.PlotEvent={})) var i=function(i){function r(t){i.call(this,t),this._plotThemeKey="",this._dataSeries=[],this._plotType=e.PlotType.USER var r=this.suppressEvents(!0) t&&(null!=t.dataSeries&&this.setDataSeries(t.dataSeries),null!=t.chartPanel&&(this.chartPanel=t.chartPanel),null!=t.theme&&(this.theme=t.theme),t.plotType&&(this._plotType=t.plotType),t.options&&(this._options=t.options),t.valueScale&&(this.valueScale=t.valueScale),this.plotStyle=t.plotStyle),t=this._options,null==t.showValueMarkers&&(t.showValueMarkers=!0),null==t.visible&&(t.visible=!0),this.suppressEvents(r)}return __extends(r,i),Object.defineProperty(r.prototype,"dataSeries",{get:function(){return this._dataSeries},set:function(e){this.setDataSeries(e)},enumerable:!0,configurable:!0}),r.prototype.setDataSeries=function(i){if(i instanceof e.DataSeries)i=[i] else if(!Array.isArray(i))throw new TypeError("Single data series or an array of data series expected.") var r=this._dataSeries r!==i&&(this._dataSeries=i,this.fire(t.DATA_SERIES_CHANGED,i,r))},Object.defineProperty(r.prototype,"theme",{get:function(){return this._theme},set:function(e){var i=this._theme this._theme=e,this.fire(t.THEME_CHANGED,e,i)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"actualTheme",{get:function(){return this._theme?this._theme:this.chart.theme.plot[this._plotThemeKey][this.plotStyle]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"plotStyle",{get:function(){var e=this._options.plotStyle return e||(e=this.constructor.defaults)&&e.plotStyle},set:function(e){this._setOption("plotStyle",e,t.STYLE_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"showValueMarkers",{get:function(){return this._options.showValueMarkers},set:function(e){this._setOption("showValueMarkers",!!e,t.SHOW_VALUE_MARKERS_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"showValueLines",{get:function(){return this._options.showValueLines},set:function(e){this._setOption("showValueLines",!!e,t.SHOW_VALUE_LINES_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"extendValueLines",{get:function(){return this._options.extendValueLines},set:function(e){this._setOption("extendValueLines",e,t.EXTEND_VALUE_LINES_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"plotType",{get:function(){return this._plotType},enumerable:!0,configurable:!0}),r.prototype._onChartPanelChanged=function(e){this.fire(t.PANEL_CHANGED,this.chartPanel,e)},r.prototype._onValueScaleChanged=function(e){this.fire(t.VALUE_SCALE_CHANGED,this.valueScale,e)},r.prototype._onVisibleChanged=function(e){this.fire(t.VISIBLE_CHANGED,this.visible,e)},r.prototype.findDataSeries=function(e){for(var t=0,i=this._dataSeries;tr&&(r=a.max))}return{min:i,max:r}},r.prototype._valueDrawParams=function(){var t,i i=this.chart var r=this._dataSeries[0],n=this.findDataSeries(e.DataSeriesSuffix.DATE),o=this.projection n?(i=i.dateScale.visibleDateRange,t=n.floorIndex(i.min),i=n.ceilIndex(i.max)):(t=i.firstVisibleIndex,i=i.lastVisibleIndex),t=Math.max(r.leftNearestVisibleValueIndex(t)-1,0),i=Math.min(r.rightNearestVisibleValueIndex(i)+1,r.length-1) var a=n?0:o.columnByRecord(t) return{context:this.context,projection:o,dates:n&&n.values,values:r.values,startIndex:t,endIndex:i,startColumn:a,theme:this.actualTheme}},r.prototype._barDrawParams=function(){var t,i i=this.chart var r=this._dataSeries,n=this.projection,o=null,a=null,s=null,l=null,c=null for(t=0;t=n.open[a],this.plotStyle){case i.OHLC:case i.HLC:case i.HL:o=n.theme.strokeColor break case i.COLORED_OHLC:case i.COLORED_HLC:case i.COLORED_HL:o=n.theme[o?"upBar":"downBar"].strokeColor break case i.CANDLE:case i.HOLLOW_CANDLE:case i.HEIKIN_ASHI:case i.RENKO:o=n.theme[o?"upCandle":"downCandle"].fill.fillColor break case i.LINE_BREAK:o=o?n.theme.upCandle.border.strokeColor:n.theme.downCandle.fill.fillColor break case i.POINT_AND_FIGURE:case i.KAGI:o=n.theme[o?"upCandle":"downCandle"].border.strokeColor break default:return}r.fill.fillColor=o,r.text.fillColor=e.HtmlUtil.isDarkColor(o)?"white":"black",n=n.close[a],t.draw(n,this.panelValueScale),this.showValueLines&&null!=n&&(t=new e.ValueLine({point:{record:a+.5,value:n},theme:{strokeColor:r.fill.fillColor},extended:this.extendValueLines,visible:this.showValueLines}),t.chartPanel=this.chartPanel,t.valueScale=this.valueScale,t.draw())}}},n.prototype._drawBars=function(){var e=this._barDrawParams() if(0!==e.values.length){var t=e.context,i=e.projection,r=e.dates,o=0,a=this.plotStyle,s=a===n.Style.OHLC,a=a===n.Style.HLC;(s||a)&&(o=Math.round(Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minWidth)/2)),t.beginPath() for(var l=e.startIndex,c=e.startColumn;l<=e.endIndex;l++,c++){var h=e.open[l],u=e.high[l],d=e.low[l],p=e.close[l] if(null!=h&&null!=u&&null!=d&&null!=p){var f=r?i.xByDate(r[l]):i.xByColumn(c),u=i.yByValue(u),d=i.yByValue(d) s&&(h=i.yByValue(h),t.moveTo(f,h),t.lineTo(f-o,h)),(s||a)&&(p=i.yByValue(p),t.moveTo(f,p),t.lineTo(f+o,p)),u===d&&d--,t.moveTo(f,u),t.lineTo(f,d)}}t.scxApplyStrokeTheme(e.theme),t.stroke()}},n.prototype._drawColoredBars=function(){var e=this._barDrawParams() 0!==e.values.length&&(this._drawColoredBarItems(e,!0,e.theme.upBar),this._drawColoredBarItems(e,!1,e.theme.downBar))},n.prototype._drawColoredBarItems=function(e,t,i){var r=e.context,o=e.projection,a=this.plotStyle,s=a===n.Style.COLORED_OHLC,a=a===n.Style.COLORED_HLC,l=0;(s||a)&&(l=Math.round(Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minWidth)/2)),r.beginPath() for(var c=e.startIndex,h=e.startColumn;c<=e.endIndex;c++,h++){var u=e.open[c],d=e.high[c],p=e.low[c],f=e.close[c],m=f>=u null!=u&&null!=d&&null!=p&&null!=f&&t===m&&(m=e.dates?o.xByDate(e.dates[c]):o.xByColumn(h),d=o.yByValue(d),p=o.yByValue(p),s&&(u=o.yByValue(u),r.moveTo(m,u),r.lineTo(m-l,u)),(s||a)&&(f=o.yByValue(f),r.moveTo(m,f),r.lineTo(m+l,f)),d===p&&p--,r.moveTo(m,d),r.lineTo(m,p))}r.scxApplyStrokeTheme(i),r.stroke()},n.prototype._drawCandles=function(){var e=this._barDrawParams() if(0!==e.values.length){var t=e.context,i=e.theme.upCandle,r=e.theme.downCandle this._drawCandleItems(e,!0,!0),t.scxFillStroke(i.fill,i.border),this._drawCandleItems(e,!1,!0),t.scxFillStroke(r.fill,r.border),this._drawCandleItems(e,!0,!1),t.scxStroke(i.wick),this._drawCandleItems(e,!1,!1),t.scxStroke(r.wick)}},n.prototype._drawCandleItems=function(e,t,i){var r=e.context,n=e.projection,o=Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minWidth),a=Math.round(o/2),o=2*a r.beginPath() for(var s=e.startIndex,l=e.startColumn;s<=e.endIndex;s++,l++){var c=e.open[s],h=e.high[s],u=e.low[s],d=e.close[s],p=d>=c null!=c&&null!=h&&null!=u&&null!=d&&t===p&&(p=e.dates?n.xByDate(e.dates[s]):n.xByColumn(l),c=n.yByValue(c),d=n.yByValue(d),i?r.rect(p-a,Math.min(c,d),o,Math.max(Math.abs(c-d),1)):(h=n.yByValue(h),u=n.yByValue(u),r.moveTo(p,Math.min(c,d)),r.lineTo(p,h),r.moveTo(p,Math.max(c,d)),r.lineTo(p,u)))}},n.prototype._drawHollowCandles=function(){var e=this._barDrawParams() if(0!==e.values.length){var t=e.context,i=e.theme.upCandle,r=e.theme.downCandle,n=e.theme.upHollowCandle,o=e.theme.downHollowCandle this._drawHollowCandleItems(e,!0,!0,!1),t.scxStroke(n.border),this._drawHollowCandleItems(e,!0,!0,!0),t.scxStroke(n.wick),this._drawHollowCandleItems(e,!0,!1,!1),t.scxFillStroke(i.fill,i.border),this._drawHollowCandleItems(e,!0,!1,!0),t.scxStroke(i.wick),this._drawHollowCandleItems(e,!1,!0,!1),t.scxStroke(o.border),this._drawHollowCandleItems(e,!1,!0,!0),t.scxStroke(o.wick),this._drawHollowCandleItems(e,!1,!1,!1),t.scxFillStroke(r.fill,r.border),this._drawHollowCandleItems(e,!1,!1,!0),t.scxStroke(r.wick)}},n.prototype._drawHollowCandleItems=function(e,t,i,r){for(var n=e.context,o=e.projection,a=null,s=Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minWidth),l=Math.round(s/2),s=2*l,c=e.startIndex-1;0<=c;c--)if(null==e.open[c]&&null==e.high[c]&&null==e.low[c]&&null==e.close[c]){a=e.close[c] break}n.beginPath() for(var c=e.startIndex,h=e.startColumn;c<=e.endIndex;c++,h++){var u=e.open[c],d=e.high[c],p=e.low[c],f=e.close[c] if(null!=u&&null!=d&&null!=p&&null!=f){null==a&&(a=u) var m=f>=a,v=f>u a=f,t===m&&i===v&&(m=e.dates?o.xByDate(e.dates[c]):o.xByColumn(h),u=o.yByValue(u),f=o.yByValue(f),r?(d=o.yByValue(d),p=o.yByValue(p),n.moveTo(m,Math.min(u,f)),n.lineTo(m,d),n.moveTo(m,Math.max(u,f)),n.lineTo(m,p)):n.rect(m-l,Math.min(u,f),s,Math.max(Math.abs(u-f),1)))}}},n.prototype._drawBricks=function(){var e=this._barDrawParams() 0!==e.values.length&&(this._drawBrickItems(e,!0),this._drawBrickItems(e,!1))},n.prototype._drawBrickItems=function(e,t){var i=e.context,r=e.projection,n=Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minWidth),o=Math.round(n/2) i.beginPath() for(var a=e.startIndex,s=e.startColumn;a<=e.endIndex;a++,s++){var l=e.open[a],c=e.close[a],h=c>=l n=2*o,null==l||null==c||t&&!h||!t&&h||(h=e.dates?r.xByDate(e.dates[a]):r.xByColumn(s),l=r.yByValue(l),c=r.yByValue(c),i.rect(h-o,Math.min(l,c),n,Math.max(Math.abs(l-c),1)))}r=t?e.theme.upCandle:e.theme.downCandle,i.scxFillStroke(r.fill,r.border)},n.prototype._drawKagi=function(){var e=this._barDrawParams() 0!==e.values.length&&(this._drawKagiItems(e,!0),this._drawKagiItems(e,!1))},n.prototype._drawKagiItems=function(e,t){var i=e.context,r=e.projection,n=null,o=null,a=!1,s=null i.beginPath() for(var l=0;l<=e.endIndex;l++){var c=e.open[l],h=e.close[l],u=c,d=h,p=!0 null!=c&&null!=h&&(null===o?(o=h>=c,p=!1):o?hs&&(a=!0,p=!t,u=t?s:c,d=t?h:s),s=e.dates?r.xByDate(e.dates[l]):r.xByRecord(l),l>=e.startIndex&&(o===t||a)&&(u=r.yByValue(u),d=r.yByValue(d),p?(i.moveTo(n,u),i.lineTo(s,u)):i.moveTo(s,u),i.lineTo(s,d)),n=s,s=o?a?Math.max(c,h):Math.min(c,h):a?Math.min(c,h):Math.max(c,h),a&&(o=!o,a=!1))}i.scxStroke(e.theme[t?"upCandle":"downCandle"].border)},n.Style=i,n.defaults={plotStyle:i.CANDLE,minWidth:3,columnWidthRatio:.8},n}(e.Plot) e.BarPlot=r}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t={LINE:"line",COLORED_LINE:"coloredLine",COLUMN:"column",COLORED_COLUMN:"coloredColumn"} Object.freeze(t) var i=function(i){function r(e){i.call(this,e),this._plotThemeKey="histogram"}return __extends(r,i),Object.defineProperty(r.prototype,"baseValue",{get:function(){var e=this._options.baseValue return null!=e?e:r.defaults.baseValue},set:function(t){if(!e.JsUtil.isFiniteNumber(t))throw new TypeError("Value must be a finite number.") this._setOption("baseValue",t,e.PlotEvent.BASE_VALUE_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"columnWidthRatio",{get:function(){return this._options.columnWidthRatio||r.defaults.columnWidthRatio},set:function(t){if(e.JsUtil.isNegativeNumber(t)||1=e.open[c])){var d=r?i.xByDate(r[c]):i.xByColumn(h) d===s?l=Math.max(l,u):(null!==s&&(t.moveTo(d,i.yByValue(u)),t.lineTo(d,n)),l=u,s=d)}}t.moveTo(s,i.yByValue(l)),t.lineTo(s,n),t.scxApplyStrokeTheme(a),t.stroke()} o(!0,e.theme.upBar),o(!1,e.theme.downBar)}},r.prototype._drawColumns=function(){var e=this._barDrawParams() if(0!==e.values.length){var t,i=e.context,r=e.projection,n=e.dates,o=r.yByValue(this.baseValue),a=Math.round(Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minColumnWidth)/2),s=2*a,l=null,c=-1/0 i.beginPath() for(var h=e.startIndex,u=e.startColumn;h<=e.endIndex;h++,u++){var d=e.values[h] if(null!=d){var p=n?r.xByDate(n[h]):r.xByColumn(u) p===l?c=Math.max(c,d):(null!==l&&(t=r.yByValue(c),i.rect(l-a,Math.min(t,o),s,Math.max(Math.abs(t-o),1))),c=d,l=p)}}t=r.yByValue(c),i.rect(l-a,Math.min(t,o),s,Math.max(Math.abs(t-o),1)),e=e.theme,i.scxFillStroke(e.fill,e.line)}},r.prototype._drawColoredColumns=function(){var e=this._barDrawParams() if(0!==e.values.length){var t,i=e.context,r=e.projection,n=e.dates,o=r.yByValue(this.baseValue),a=Math.round(Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minColumnWidth)/2),s=2*a,l=function(l,c){var h=null,u=-1/0 i.beginPath() for(var d=e.startIndex,p=e.startColumn;d<=e.endIndex;d++,p++){var f=e.values[d] if(!(null==f||l&&e.close[d]=e.open[d])){var m=n?r.xByDate(n[d]):r.xByColumn(p) m===h?u=Math.max(u,f):(null!==h&&(t=r.yByValue(u),i.rect(h-a,Math.min(t,o),s,Math.max(Math.abs(t-o),1))),u=f,h=m)}}t=r.yByValue(u),i.rect(h-a,Math.min(t,o),s,Math.max(Math.abs(t-o),1)),i.scxFillStroke(c.fill,c.line)} l(!0,e.theme.upCandle),l(!1,e.theme.downCandle)}},r.Style=t,r.defaults={plotStyle:t.LINE,baseValue:0,columnWidthRatio:.5,minWidth:3},r}(e.Plot) e.HistogramPlot=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t={SIMPLE:"simple",MOUNTAIN:"mountain",STEP:"step"} Object.freeze(t) var i=function(e){function i(t){e.call(this,t),this._plotThemeKey="line"}return __extends(i,e),i.prototype.draw=function(){if(this.visible)switch(this.plotStyle){case t.MOUNTAIN:this._drawMountainLine() break case t.STEP:this._drawStepLine() break default:this._drawSimpleLine()}},i.prototype._drawSimpleLine=function(){var e=this._valueDrawParams() if(0!==e.values.length){var t=e.context,i=e.projection,r=e.dates,n=null,o=null,a=1/0,s=-1/0,l=!0,c=null t.beginPath() for(var h=e.startIndex,u=e.startColumn;h<=e.endIndex;h++,u++){var d=e.values[h] if(null!=d){var p=d!==d if(!p||!l){var f=r?i.xByDate(r[h]):i.xByColumn(u) if(l)t.moveTo(f,i.yByValue(d)),l=!1 else if(p&&(l=!0),l||f!=n){if(a!==1/0){var m=i.yByValue(a),v=1.8Math.abs(s-a)?v&&t.lineTo(n,m):(p=i.yByValue(s),1.8>Math.abs(p-m)?v&&t.lineTo(n,m):(v&&t.moveTo(n,m),t.lineTo(n,p),1e-5Math.abs(c-l)?(i.lineTo(o,f),a=f):(l=r.yByValue(c),1.8>Math.abs(l-f)?(i.lineTo(o,f),a=f):(i.moveTo(o,f),i.lineTo(o,l),a=r.yByValue(s),i.moveTo(o,a))),l=c=s=p),o=t):(l=Math.min(l,p),c=Math.max(c,p),s=p)))}}null!=s&&s!==-1/0&&(i.lineTo(t,a),i.lineTo(t,r.yByValue(s))),i.scxApplyStrokeTheme(e.theme.line||e.theme),i.stroke()}},i.Style=t,i.defaults={plotStyle:t.SIMPLE},i}(e.Plot) e.LinePlot=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t;(t=e.PlotEvent||(e.PlotEvent={})).POINT_SIZE_CHANGED="plotPointSizeChanged" var i={DOT:"dot"} Object.freeze(i) var r=function(r){function n(e){r.call(this,e),this._plotThemeKey="point"}return __extends(n,r),Object.defineProperty(n.prototype,"pointSize",{get:function(){return this._options.pointSize||n.defaults.pointSize},set:function(i){if(e.JsUtil.isNegativeNumber(i))throw new TypeError("Value must be a positive number.") this._setOption("pointSize",i,t.POINT_SIZE_CHANGED)},enumerable:!0,configurable:!0}),n.prototype.draw=function(){if(this.visible){var e=this._valueDrawParams() if(0!==e.values.length){var t,i=e.context,r=e.projection,n=e.dates,o=this.pointSize,a=null,s=[],l=[],c=function(e){for(var t=0,r=l.length;t=e.startIndex;a--)null!=(r=this.dataSeries[1].values[a])&&(t=o.xByRecord(a),i=o.yByValue(r),n.lineTo(t,i)) r=this.dataSeries[0].values[e.startIndex],null==r&&(r=this.dataSeries[0].values[this.getFirstNotNullValueIndex(this.dataSeries[0])],e.startIndex=this.getFirstNotNullValueIndex(this.dataSeries[0])),t=o.xByRecord(e.startIndex),i=o.yByValue(r),n.lineTo(t,i),n.scxFill(e.theme)}}},t.prototype.getFirstNotNullValueIndex=function(e){for(var t=0,i=!0;i&&t=c)for(var c=e.dates?r.xByDate(e.dates[s]):r.xByColumn(l),h=e.low[s],u=e.high[s];1e-6=r||((null==e||0>e||e>=r)&&(e=r-1),r=i.dataSeries.valueAtIndex(e),r=this._panel.formatValue(r),i.titleValueSpan.text(r))}}},i.prototype._addPlot=function(e,t){this._panel.addPlot(e),this._initPanelTitle() for(var i=this._plotItems,r=0;ri){for(var r=0;r<-i;r++)e.push(this._createValueMarker()),t.push(this._createValueMarker()) this._crossHair.applyTheme(),this.updateVisibility(!1)}},i.prototype.layout=function(){var e=this.chart this._controls||this._createControls(),this._syncValueMarkers() var t=this._controls,i=e.chartPanelsContainer.panelsContentFrame t.lines.$horLine.css("left",i.left).width(i.width),t.lines.$verLine.css("top",i.top).height(i.height) for(var i=e.valueScales,r=0;r=r.leftMarkers.length);s++){var l=o&&a[s].leftPanelVisible,c=o&&a[s].rightPanelVisible r.leftMarkers[s].visible=l,r.rightMarkers[s].visible=c,e.HtmlUtil.setVisibility(r.leftMarkers[s].$control,l),e.HtmlUtil.setVisibility(r.rightMarkers[s].$control,c)}n=n===e.CrossHairType.CROSS||n===e.CrossHairType.CROSS_BARS,i=r.lines.visible=i&&n,e.HtmlUtil.setVisibility(r.lines.$horLine,i),e.HtmlUtil.setVisibility(r.lines.$verLine,i),n=this.chart.dateScale,i=r.topMarker.visible=o&&n.topPanelVisible,o=r.bottomMarker.visible=o&&n.bottomPanelVisible,e.HtmlUtil.setVisibility(r.topMarker.$control,i),e.HtmlUtil.setVisibility(r.bottomMarker.$control,o)}},i.prototype.setPosition=function(e,t){this._position=e,t?this._positionAnimation.start():this.updatePosition()},i.prototype.updatePosition=function(t){if(this._positionAnimation){this._positionAnimation.stop() var i=this._position if(i){var r=this.chart,n=r.findPanelAt(i.y) if(n){var o=this._controls,a=this._prevPosition,s=this._crossHair.crossHairType if(a.x!==i.x||!0===t){a.x=i.x var l=r.dateScale,c=l.projection s===e.CrossHairType.CROSS_BARS&&(i.x=c.xByRecord(c.recordByX(i.x,!0))),o.lines.visible&&o.lines.$verLine.css("left",i.x) var s=o.topMarker,h=o.bottomMarker;(s.visible||h.visible)&&(c=c.dateByColumn(c.columnByX(i.x)),l=l.formatDate(c),this._updateDateMarker(s,l),this._updateDateMarker(h,l))}if(a.y!==i.y||!0===t)for(a.y=i.y,o.lines.visible&&o.lines.$horLine.css("top",i.y),t=r.valueScales,i=i.y-n.frame.top-r.chartPanelsContainer.frame.top,r=0;ri-e.halfWidth?i-2*e.halfWidth:this._position.x-e.halfWidth e.$control.text(t).css("left",Math.max(i,0))}},i.prototype.destroy=function(){var e=this._controls e.lines.$horLine.remove(),e.lines.$verLine.remove(),e.topMarker.$control.remove(),e.bottomMarker.$control.remove() for(var t=0,i=e.leftMarkers;to&&(i.recordRange(o,r),i.setNeedsUpdate(),this._zoomMode===e.ZoomInMode.RECT?this._setScalesValues(n[0].y,n[1].y):i.setNeedsAutoScale()),this._points=null,this.rootDiv.find("."+t.ZOOM_RECTANGLE).remove(),i.fireValueChanged(e.ChartEvent.ZOOM_IN_FINISHED)},r.prototype.cancelDraw=function(){this._points=null,this.panel&&(this.updateVisibility(!1),this.rootDiv.find("."+t.ZOOM_RECTANGLE).remove())},r.prototype.applyTheme=function(){var e=this.theme this._controls.rectangle.scxBorder("border",e.border).scxFill(e.fill)},r.prototype.updateVisibility=function(i){var r=this._controls this._controls&&(i?this.rootDiv.addClass(t.ZOOM_IN):this.rootDiv.removeClass(t.ZOOM_IN),e.HtmlUtil.setVisibility(r.rectangle,i))},r.prototype.setPosition=function(e){this._startPoint=this._points[0],e?this._positionAnimation.start():this.draw()},r.prototype.movePosition=function(e,t){this._movePoint=e,t?this._positionAnimation.start():this.draw()},r.prototype.draw=function(){if(this._positionAnimation){this._positionAnimation.stop() var t=this._startPoint if(t){var i=null==this._movePoint?t:this._movePoint,r=0,n=0,o=0,a=0 this.zoomMode===e.ZoomInMode.DATE_RANGE?(n=0,o=Math.abs(i.x-t.x),a=this.panelHeight,r=t.x>i.x?i.x:t.x):(o=Math.abs(i.x-t.x),a=Math.abs(i.y-t.y),t.x<=i.x?(r=t.x,n=t.y<=i.y?t.y:i.y):(r=i.x,n=t.y<=i.y?i.y-a:i.y)),t=this._controls.rectangle,t.scxFrame({left:r,top:n,width:o,height:a}),t.css("position","absolute")}}},r.prototype._setScalesValues=function(e,t){for(var i=0,r=this.chart.chartPanels;i=this.pointsNeeded&&this._finishUserDrawing(),(i=this.chartPanel)&&i.setNeedsUpdate()},r.prototype._handleUserDrawingMoveGesture=function(e,t){0=i&&o<=r&&(o==r?s.rotate(Math.PI/2):s.rotate(a)),n>=i&&o>=r&&(n==i?s.rotate(2*Math.PI):s.rotate(Math.PI-a)),n<=i&&o>=r&&s.rotate(Math.PI+a),s.beginPath(),s.lineTo(0,0),s.lineTo(0,-c),s.lineTo(-25,-u),s.lineTo(-h,-u),s.lineTo(-h,0),s.lineTo(h,0),s.lineTo(h,-u),s.lineTo(25,-u),s.lineTo(0,-c),s.closePath(),s.scxFillStroke(l.fill,l.stroke),s.restore(),this.selected&&this._drawSelectionMarkers(t)}}},i}(e.ArrowDrawingBase) e.Arrow=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"lineSegment"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints() return e.lengththis._dragPoint)){var r=this.projection,n=this.chartPoints,o=i.pointerPosition switch(this._dragPoint){case 0:n[0].moveTo(o.x,o.y,r) break case 1:n[0].moveToY(o.y,r) break case 2:n[0].moveToY(o.y,r),n[1].moveToX(o.x,r) break case 3:n[1].moveToX(o.x,r) break case 4:n[1].moveTo(o.x,o.y,r) break case 5:n[1].moveToY(o.y,r) break case 6:n[0].moveToX(o.x,r),n[1].moveToY(o.y,r) break case 7:n[0].moveToX(o.x,r)}return!0}}return!1},i.prototype._updateCursor=function(){var t switch(this._dragPoint){case 0:case 4:t=e.DrawingCursorClass.RESIZE_NWSE break case 1:case 5:t=e.DrawingCursorClass.RESIZE_NS break case 2:case 6:t=e.DrawingCursorClass.RESIZE_NESW break case 3:case 7:t=e.DrawingCursorClass.RESIZE_EW}t&&this.changeCursor(t)},i.prototype.draw=function(){if(this.visible){var e=this.bounds(),t=this.context,i=this.actualTheme e&&(t.beginPath(),t.rect(e.left,e.top,e.width,e.height),t.scxFillStroke(i.fill,i.line)),this.selected&&(e=this._markerPoints(e),this._drawSelectionMarkers(e))}},i}(e.Drawing) e.RectangleDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"triangle"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 3},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints() if(e.lengthe.length)return null var t=Math.max.apply(Math,e.map(function(e){return e.x})),i=Math.min.apply(Math,e.map(function(e){return e.x})),r=Math.max.apply(Math,e.map(function(e){return e.y})),e=Math.min.apply(Math,e.map(function(e){return e.y})) return{left:i,top:r,width:Math.abs(t-i),height:Math.abs(r-e)}},i.prototype.hitTest=function(t){return e.Geometry.isPointNearPolygon(t,this.cartesianPoints())},i.prototype._handleUserDrawingPoint=function(t){var i=this.chartPoints.length if(1e.length)return null var t=Math.max.apply(Math,e.map(function(e){return e.x})),i=Math.min.apply(Math,e.map(function(e){return e.x})),r=Math.max.apply(Math,e.map(function(e){return e.y})),e=Math.min.apply(Math,e.map(function(e){return e.y})) return{left:i,top:r,width:Math.abs(t-i),height:Math.abs(r-e)}},i.prototype.hitTest=function(t){return e.Geometry.isPointNearPolyline(t,this.cartesianPoints())},i.prototype._handleUserDrawingPoint=function(t){var i=this.chartPoints.length if(1e.length)return null var t=e.reduce(function(e,t){return Math.max(e,t.x)},-1/0),i=e.reduce(function(e,t){return Math.min(e,t.x)},1/0),r=e.reduce(function(e,t){return Math.max(e,t.y)},-1/0),e=e.reduce(function(e,t){return Math.min(e,t.y)},1/0) return{left:i,top:e,width:Math.abs(t-i),height:Math.abs(r-e)}},i.prototype.hitTest=function(t){return e.Geometry.isPointNearPolyline(t,this.cartesianPoints())},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints(),t=this.context,i=this.actualTheme t.beginPath(),t.moveTo(e[0].x,e[0].y) for(var r=1;r=t.length?e:t}),i=e.DummyCanvasContext.measureText(i,this.actualTheme.text) return{left:t.x,top:t.y,width:i.width,height:i.height*this._lines.length}},r.prototype._finishUserDrawing=function(){var t=this e.Drawing.prototype._finishUserDrawing.call(this),e.UI.ViewLoader.drawingSettingsDialog(function(e){e.show({chart:t.chart,drawing:t,cancel:function(){t.chartPanel.removeDrawings(t)},always:function(){t.chartPanel.setNeedsUpdate()}})})},r.prototype.hitTest=function(t){var i=this.bounds() return i&&e.Geometry.isPointInsideOrNearRect(t,i)},r.prototype.loadState=function(e){i.prototype.loadState.call(this,e),this._updateLines()},r.prototype.draw=function(){if(this.visible){var t=this._lines if(0!==t.length){var i=this.cartesianPoint(0) if(i){var r=this.context,n=this.actualTheme.text r.scxApplyTextTheme(n),r.textBaseline="middle",r.textAlign="left" for(var o=this.bounds(),a=e.DummyCanvasContext.measureText(t[0],n).height,s=Math.round(a/2),l=i.y,c=0;c=this._image.width)return{x:Math.round(t+5),y:Math.round(i+5)} var r=this.actualSize,n=t+r.width,r=i+r.height,o=Math.round((t+n)/2),a=Math.round((i+r)/2) return[e,{x:o,y:i},{x:n,y:i},{x:n,y:a},{x:n,y:r},{x:o,y:r},{x:t,y:r},{x:t,y:a}]},r.prototype._finishUserDrawing=function(){var t=this i.prototype._finishUserDrawing.call(this),e.UI.ViewLoader.drawingSettingsDialog(function(e){e.show({chart:t.chart,drawing:t,cancel:function(){t.chartPanel.removeDrawings(t)},always:function(){t.chartPanel.setNeedsUpdate()}})})},r.prototype.hitTest=function(t){var i=this.bounds() return i&&e.Geometry.isPointInsideOrNearRect(t,i)},r.prototype.loadState=function(e){i.prototype.loadState.call(this,e),this._reloadImage()},r.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this._markerPoints() if(r&&1this._dragPoint)){var r=this.projection,n=this.chartPoints[0],o=i.pointerPosition,a=this.actualSize,s=t.moveOffset,l=n.toPoint(r) switch(this._dragPoint){case 0:n.moveTo(o.x,o.y,r),a&&(a.width-=n.getX(r)-l.x,a.height-=n.getY(r)-l.y) break case 1:n.moveToY(o.y,r),a&&(a.height-=n.getY(r)-l.y) break case 2:n.moveToY(o.y,r),a&&(a.width+=s.x,a.height-=n.getY(r)-l.y) break case 3:a&&(a.width+=s.x) break case 4:a&&(a.width+=s.x,a.height+=s.y) break case 5:a&&(a.height+=s.y) break case 6:n.moveToX(o.x,r),a&&(a.width-=n.getX(r)-l.x,a.height+=s.y) break case 7:n.moveToX(o.x,r),a&&(a.width-=n.getX(r)-l.x) break default:return!0}return this.size=a,!0}}return!1},r.prototype._updateCursor=function(){var t switch(this._dragPoint){case 0:case 4:t=e.DrawingCursorClass.RESIZE_NWSE break case 1:case 5:t=e.DrawingCursorClass.RESIZE_NS break case 2:case 6:t=e.DrawingCursorClass.RESIZE_NESW break case 3:case 7:t=e.DrawingCursorClass.RESIZE_EW}t&&this.changeCursor(t)},r.prototype.draw=function(){if(this.visible){var e=this.cartesianPoint(0) if(e){var t=this.context,i=e.x,r=e.y if(0n.width&&(i+=n.width),0>n.height&&(r+=n.height),t.drawImage(this._image,i,r,Math.abs(n.width),Math.abs(n.height))):t.drawImage(this._image,i,r)}else t.beginPath(),t.rect(i,r,10,10),t.moveTo(i,r),t.lineTo(i+10,r+10),t.moveTo(i,r+10),t.lineTo(i+10,r),t.scxStroke({strokeColor:"red",width:1}) this.selected&&this._drawSelectionMarkers(this._markerPoints(e))}}},r}(e.Drawing) e.ImageDrawing=i,e.Drawing.register(i)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e),this._lines=[]}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"balloon"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"text",{get:function(){return this._options.text||""},set:function(t){this._setOption("text",t||"",e.DrawingEvent.TEXT_CHANGED),this._updateLines()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cornerRadius",{get:function(){return this._options.cornerRadius||this._defaults.corderRadius||i.defaults.corderRadius},set:function(t){if(t&&!e.JsUtil.isPositiveNumber(t))throw Error("Corder radius must be a positive number.") this._options.cornerRadius=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"anchorSize",{get:function(){return this._options.anchorSize||this._defaults.anchorSize||i.defaults.anchorSize},set:function(e){this._options.anchorSize=e},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){if(!this._leftTopPoint||!this.cartesianPoint(0))return null var e=this._leftTopPoint.x,t=this._leftTopPoint.y return{left:e,top:t,width:Math.abs(this._rightBottomPoint.x-e),height:Math.abs(this._rightBottomPoint.y-t)}},i.prototype._finishUserDrawing=function(){var i=this t.prototype._finishUserDrawing.call(this),e.UI.ViewLoader.drawingSettingsDialog(function(e){e.show({chart:i.chart,drawing:i,cancel:function(){i.chartPanel.removeDrawings(i)},always:function(){i.chartPanel.setNeedsUpdate()}})})},i.prototype.hitTest=function(t){var i=this.bounds() return i&&e.Geometry.isPointInsideOrNearRect(t,i)},i.prototype.loadState=function(e){t.prototype.loadState.call(this,e),this._updateLines()},i.prototype.draw=function(){if(this.visible){var t=this.cartesianPoint(0) if(t){var i=this._lines,r=i.reduce(function(e,t){return e.length>=t.length?e:t}),n=this.context,o=this.actualTheme,a=o.text,r=e.DummyCanvasContext.measureText(r,o.text),s=Math.ceil(r.width/2),l=this.cornerRadius,c=s+l,h=Math.ceil(this.anchorSize.width/2),u=this.anchorSize.height,d=t.y-u,u=d-r.height*i.length-u n.beginPath(),n.moveTo(t.x,t.y),n.lineTo(t.x-h,d),n.lineTo(t.x-s,d) var p=t.x-c for(n.quadraticCurveTo(p,d,p,d-l),n.lineTo(p,u+l),n.quadraticCurveTo(p,u,t.x-s,u),n.lineTo(t.x+s,u),c=t.x+c,n.quadraticCurveTo(c,u,c,u+l),n.lineTo(c,d-l),n.quadraticCurveTo(c,d,t.x+s,d),n.lineTo(t.x+h,d),n.closePath(),n.scxFillStroke(o.fill,o.line),this._leftTopPoint={x:p,y:u},this._rightBottomPoint={x:c,y:t.y},n.scxApplyTextTheme(o.text),n.textBaseline="middle",n.textAlign="left",o=Math.round(u+2*r.height/3+1),l=0;lc.y:l.yc.x)?-1:1,this._yDirection=h?-1:1,h=1===this._yDirection?e.MeasureArrowDrawingMode.START:e.MeasureArrowDrawingMode.END,this._drawArrowHeadLine(o,a,1===this._xDirection?e.MeasureArrowDrawingMode.END:e.MeasureArrowDrawingMode.START),this._drawArrowHeadLine(s,r,h) var a=this.projection,o=l.getValue(a),a=c.getValue(a),s=this.chart.barsBetweenPoints(l,c),l=this.panelValueScale.formatValue((o-a)*this._yDirection),c=e.DummyCanvasContext.measureText(l,i.balloon.text),o=(s*this._xDirection).toFixed()+" bars, "+this._duration(),a=e.DummyCanvasContext.measureText(o,i.balloon.text),s=Math.max(c.width,a.width)+2,r=r.x-s/2,h=t.top+t.height+4,u=h+c.height,d=u+c.height this._drawRoundRect(r,h,s,c.height+a.height+2),n.scxApplyTextTheme(i.balloon.text),n.textBaseline="alphabetic",n.textAlign="left",n.fillText(l,r+3,u),n.fillText(o,r+3,d),this.selected&&this._drawSelectionMarkers(this._markerPoints(t))}}},i.prototype._drawArrowHeadLine=function(t,i,r){var n n=this.context var o=this.actualTheme n.beginPath(),n.moveTo(t.x,t.y),n.lineTo(i.x,i.y),n.scxStroke(o.line),n=i.x-t.x var o=i.y-t.y,a=(i.x>t.x?-90:90)*Math.PI/180 switch(r){case e.MeasureArrowDrawingMode.BOTH:r=Math.atan(o/n)+a,r===Math.PI&&(r=0),n=Math.atan(o/n)-a,0===n&&(n=Math.PI),this._drawArrow(t,r),this._drawArrow(i,n) break case e.MeasureArrowDrawingMode.START:r=Math.atan(o/n)+a,r===Math.PI&&(r=0),this._drawArrow(t,r) break case e.MeasureArrowDrawingMode.END:n=Math.atan(o/n)-a,0===n&&(n=Math.PI),this._drawArrow(i,n)}},i.prototype._drawArrow=function(e,t){var i=this.context,r=this.actualTheme i.save(),i.beginPath(),i.translate(e.x,e.y),i.rotate(t),i.moveTo(0,0),i.lineTo(5,5),i.moveTo(0,0),i.lineTo(-5,5),i.closePath(),i.scxStroke(r.line),i.restore()},i.prototype._drawRoundRect=function(e,t,i,r,n){null==n&&(n=this.cornerRadius) var o=this.context i=e+(i+n),r=t+(r+n),o.beginPath(),o.moveTo(e+n,t),o.lineTo(i-n,t),o.quadraticCurveTo(i,t,i,t+n),o.lineTo(i,r-n),o.quadraticCurveTo(i,r,i-n,r),o.lineTo(e+n,r),o.quadraticCurveTo(e,r,e,r-n),o.lineTo(e,t+n),o.quadraticCurveTo(e,t,e+n,t),o.closePath(),e=this.actualTheme.balloon,o.scxFillStroke(e.fill,e.border)},i.defaults={cornerRadius:5},i}(e.Drawing) e.MeasureDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),Object.defineProperty(t,"className",{get:function(){return"measureTool"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),t.prototype.bounds=function(){var e=this.cartesianPoints() return e.lengthe[n].value){var o=e[i] e[i]=e[n],e[n]=o}this._options.levels=e,this.fire(t.LEVELS_CHANGED,e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showTrendLine",{get:function(){var e=this._optionValue("showTrendLine") return null!=e?e:n.defaults.showTrendLine},set:function(e){this._setOption("showTrendLine",e,t.SHOW_TREND_LINE_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevelLines",{get:function(){var e=this._optionValue("showLevelLines") return null!=e?e:n.defaults.showLevelLines},set:function(e){this._setOption("showLevelLines",e,t.SHOW_LEVEL_LINES_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevelBackgrounds",{get:function(){var e=this._optionValue("showLevelBackgrounds") return null!=e?e:n.defaults.showLevelBackgrounds},set:function(e){this._setOption("showLevelBackgrounds",e,t.SHOW_LEVEL_BACKGROUNDS_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevelValues",{get:function(){var e=this._optionValue("showLevelValues") return null!=e?e:n.defaults.showLevelValues},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevels",{set:function(e){this._setOption("showLevelValues",e,t.SHOW_LEVEL_VALUES_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevelPrices",{get:function(){var e=this._optionValue("showLevelPrices") return null!=e?e:n.defaults.showLevelPrices},set:function(e){this._setOption("showLevelPrices",e,t.SHOW_LEVEL_PRICES_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevelPercents",{get:function(){var e=this._optionValue("showLevelPercents") return null!=e?e:n.defaults.showLevelPercents},set:function(e){this._setOption("showLevelPercents",e,t.SHOW_LEVEL_PERCENTS_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"levelTextHorPosition",{get:function(){var e=this._optionValue("levelTextHorPosition") return null!=e?e:n.defaults.levelTextHorPosition},set:function(e){this._setOption("levelTextHorPosition",e,t.LEVEL_TEXT_HOR_POSITION_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"levelTextVerPosition",{get:function(){var e=this._optionValue("levelTextVerPosition") return null!=e?e:n.defaults.levelTextVerPosition},set:function(e){this._setOption("levelTextVerPosition",e,t.LEVEL_TEXT_VER_POSITION_CHANGED)},enumerable:!0,configurable:!0}),n.prototype._showSettingsDialog=function(){var t=this e.UI.ViewLoader.fibonacciDrawingSettingsDialog(function(e){e.show({chart:t.chart,drawing:t})})},n.prototype._applyTextPosition=function(){var t,i,r=this.context switch(this.levelTextVerPosition){case e.FibonacciLevelTextVerPosition.MIDDLE:t="middle" break case e.FibonacciLevelTextVerPosition.TOP:t="bottom" break case e.FibonacciLevelTextVerPosition.BOTTOM:t="top" break default:throw Error("Unsupported level text vertical position: "+this.levelTextVerPosition)}switch(this.levelTextHorPosition){case e.FibonacciLevelTextHorPosition.CENTER:i="center" break case e.FibonacciLevelTextHorPosition.LEFT:i="right" break case e.FibonacciLevelTextHorPosition.RIGHT:i="left" break default:throw Error("Unsupported level text horizontal position: "+this.levelTextHorPosition)}r.textBaseline=t,r.textAlign=i},n.prototype._isLevelVisible=function(e){return null==e.visible||e.visible},n.prototype._adjustXWithTextOffset=function(t){switch(this.levelTextHorPosition){case e.FibonacciLevelTextHorPosition.LEFT:return t-this._textOffset case e.FibonacciLevelTextHorPosition.RIGHT:return t+this._textOffset default:return t}},n.prototype._adjustYWithTextOffset=function(t){switch(this.levelTextVerPosition){case e.FibonacciLevelTextVerPosition.TOP:return t-this._textOffset case e.FibonacciLevelTextVerPosition.BOTTOM:return t+this._textOffset default:return t}},n.defaults=i,n}(e.Drawing) e.FibonacciDrawingBase=r}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"fibonacciArcs"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var t=this.cartesianPoints() if(t.lengtha,l=c?l.left:l.right,h=[] switch(this.levelTextVerPosition){case e.FibonacciLevelTextVerPosition.MIDDLE:i.textBaseline="middle" break case e.FibonacciLevelTextVerPosition.TOP:i.textBaseline="bottom" break case e.FibonacciLevelTextVerPosition.BOTTOM:i.textBaseline="top" break default:throw Error("Unsupported level text vertical position: "+this.levelTextVerPosition)}i.textAlign=c?"left":"right" for(var u=0,d=this.levels;ui.length)return!1 if(this.showTrendLine&&e.Geometry.isPointNearPolyline(t,i))return!0 if(this.showLevelLines||this.showLevelBackgrounds)for(var r=this._linesYRange(i),n=0,o=this.levels;ni.length)return!1 var r=i[0],n=i[1],i=i[2],o=r.x,a=r.y,s=n.x,l=n.y,c=i.x,h=i.y,u=(c-s)/2+s,d=(h-l)/2+l,p=s-(o-u),f=l-(a-d),m=c-(o-u),v=h-(a-d),g=Math.sqrt(o*u+a*d),o={x:o+(u-o)*g,y:a+(d-a)*g},a=Math.sqrt(s*p+l*f),s={x:s+(p-s)*a,y:l+(f-l)*a},l=Math.sqrt(c*m+h*v),c={x:c+(m-c)*l,y:h+(v-h)*l} return e.Geometry.isPointNearLine(t,n,i)||e.Geometry.isPointNearLine(t,r,o)||e.Geometry.isPointNearLine(t,n,s)||e.Geometry.isPointNearLine(t,i,c)},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this.cartesianPoints() if(1e.length?null:{left:Math.min(e[0].x,e[1].x),top:Math.max(e[0].y,e[1].y),width:Math.abs(e[1].x-e[0].x),height:Math.abs(e[1].y-e[0].y)}},i.prototype.hitTest=function(t){if(this.chartPoints.lengthe.length||(e[0].x>e[1].x&&(this.chartPoints[0].moveToPoint(e[1],this.projection),this.chartPoints[1].moveToPoint(e[0],this.projection)),this._drawingPoints=this._calculateDrawingPoints(e))},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints() if(0!==e.length){var t=this.context,i=this.actualTheme 1o&&(o=c.valueAtIndex(a)) for(var c=n.low,h=o,a=s;a<=l;a++)c.valueAtIndex(a)this.chartPoints.length)return!1 for(var i=this._drawingPoints,r=0;5>r;r++)if(e.Geometry.isPointNearLine(t,i[r][0],i[r][1]))return!0 return!1},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:if(e.Geometry.isPointNearPoint(this.cartesianPoint(0),i.pointerPosition))this._setDragPoint(0) else{if(!e.Geometry.isPointNearPoint(this.cartesianPoint(1),i.pointerPosition))break this._setDragPoint(1)}return this.changeCursor(e.DrawingCursorClass.RESIZE),!0 case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype._finishUserDrawing=function(){t.prototype._finishUserDrawing.call(this) var e=this.cartesianPoints() e[0].x>e[1].x&&(this.chartPoints[0].moveToPoint(e[1],this.projection),this.chartPoints[1].moveToPoint(e[0],this.projection)),this._drawingPoints=this._calculateDrawingPoints(e)},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints() if(0!==e.length){var t=this.context,i=this.actualTheme if(1r;r++)t.moveTo(e[r][0].x,e[r][0].y),t.lineTo(e[r][1].x,e[r][1].y),t.scxStroke(i.line)}this.selected&&this._drawSelectionMarkers(this.cartesianPoints())}}},i.prototype._calculateDrawingPoints=function(t){var i=t[0] t=t[1] for(var r=this.projection,n=r.recordByX(i.x),o=r.recordByX(t.x),a=Math.min(n,o),s=Math.max(n,o),n=0,l=this.chart.primaryDataSeries(e.DataSeriesSuffix.HIGH),o=a;o<=s;o++){var c=l.valueAtIndex(o) c>n&&(n=c)}for(l=n,c=this.chart.primaryDataSeries(e.DataSeriesSuffix.LOW),o=a;o<=s;o++)(a=c.valueAtIndex(o))o;o++)a-=(n-l)/4,c=r.yByValue(a),s.push([{x:i.x,y:c},{x:t.x,y:c}]) return s},i.prototype._moveMainLineYPoint=function(e,t){this.chartPoints[0].moveToY(e,this.projection),this.chartPoints[1].moveToY(t,this.projection)},i}(e.Drawing) e.QuadrantLinesDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"raffRegression"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this._drawingPoints return!e||6>e.length?null:{left:Math.min(e[0].x,e[1].x),top:Math.max(e[0].y,e[1].y),width:Math.abs(e[1].x-e[0].x),height:i._calculateBoundsHeight(e)}},i.prototype.hitTest=function(t){if(this.chartPoints.lengthe[1]&&(this.chartPoints[0].moveToPoint(e[1],this.projection),this.chartPoints[1].moveToPoint(e[0],this.projection)),this._drawingPoints=this._calculateDrawingPoints(e)},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints() if(!(1>e.length)){if(e[0].x>e[1].x){var t=e[1] e[1]=e[0],e[0]=t}var t=this.context,i=this.actualTheme 1u&&(u=f),0d&&(d=p)}return s=Math.max(u,d),a=r.yByValue(n+s),l=r.yByValue(o+s),c=r.yByValue(n),h=r.yByValue(o),n=r.yByValue(n-s),r=r.yByValue(o-s),[{x:i.x,y:a},{x:t.x,y:l},{x:i.x,y:c},{x:t.x,y:h},{x:i.x,y:n},{x:t.x,y:r}]},i.prototype._getMainLinePoints=function(){return[this._drawingPoints[2],this._drawingPoints[3]]},i.prototype._moveMainLineYPoint=function(e,t){this.chartPoints[0].moveToY(e,this.projection),this.chartPoints[1].moveToY(t,this.projection)},i._calculateBoundsHeight=function(e){return Math.abs(Math.max(e[0].y,e[1].y)-Math.min(e[4].y,e[5].y))},i}(e.Drawing) e.RaffRegressionDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"tironeLevels"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints() return e.lengthe[1].x&&(this.chartPoints[0].moveToPoint(e[1],this.projection),this.chartPoints[1].moveToPoint(e[0],this.projection)),this._drawingPoints=this._calculateDrawingPoints(e)},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints() if(0!==e.length){var t=this.context,i=this.actualTheme 1n&&(n=c)}for(c=this.chart.primaryDataSeries(e.DataSeriesSuffix.LOW),s=n,l=a;l<=o;l++)(a=c.valueAtIndex(l))e.length?null:{left:Math.min(e[0].x,e[1].x),top:Math.max(e[0].y,e[1].y),width:Math.abs(e[1].x-e[0].x),height:Math.abs(e[1].y-e[0].y)}},i.prototype.hitTest=function(t){if(this.chartPoints.lengthl return c&&sn),c?(i=this.projection.yByValue(l),n=this.projection.yByValue(a),c=l+.333*(a-l),o=this.projection.yByValue(l+.667*(a-l))):(i=this.projection.yByValue(o),n=this.projection.yByValue(s),c=o-.333*(o-s),o=this.projection.yByValue(o-.667*(o-s))),l=this.projection.yByValue(c),t=this.projection.xByRecord(this.projection.recordByX(e[0].x)),r=this.projection.xByRecord(this.projection.recordByX(e[1].x)),this._markersPoints=[{x:t,y:i},{x:r,y:n}],this.extend&&(e=Math.sqrt(t*r+i*n),r=Math.round(t+(r-t)*e),n=Math.round(i-(i-n)*e),o=Math.round(i-(i-o)*e),l=Math.round(i-(i-l)*e)),[{x:t,y:i},{x:r,y:n},{x:t,y:i},{x:r,y:o},{x:t,y:i},{x:r,y:l}]},i}(e.Drawing) e.SpeedLinesDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]) e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t !function(e){e.ANGLES_CHANGED="drawingAnglesChanged",e.SHOW_ANGLE_LINE_CHANGED="drawingShowAngleLineChanged"}(t=e.DrawingEvent||(e.DrawingEvent={})) var i=function(i){function r(){i.apply(this,arguments)}return __extends(r,i),Object.defineProperty(r,"className",{get:function(){return"gannFan"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"angles",{get:function(){return this._optionValue("angles")||r.defaults.angles},set:function(e){if(null!=e&&!Array.isArray(e))throw new TypeError("Angles must be an array of numbers.") this._options.angles=e,this.fire(t.ANGLES_CHANGED,e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),r.prototype.bounds=function(){var e=this.cartesianPoints() return 2>e.length?null:{left:Math.min(e[0].x,e[1].x),top:Math.max(e[0].y,e[1].y),width:Math.abs(e[1].x-e[0].x),height:Math.abs(e[1].y-e[0].y)}},r.prototype.hitTest=function(t){if(this.cartesianPoints().lengthn?t.left:t.right,a=[],s=0,l=this.angles;s=t.length?e:t}),n=e.DummyCanvasContext.measureText(n,i.text),i=n.width+5,r=n.height*r.length+10 this._showTextDOM({left:t.x-i,top:t.y-r,width:i,height:r})}},t.prototype.drawImage=function(e){var t=this._image,i=t.width,t=t.height,r=e.x-i e=e.y-t,0