text: "use strict";!function(n){"object"==typeof module&&module.exports?module.exports=n.default=n:"function"==typeof define&&define.amd?define("highcharts/indicators/regressions",["highcharts","highcharts/modules/stock"],function(e){return n(e),n.Highcharts=e,n}):n("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(e){var n=e?e._modules:{};function t(e,n,t,r){e.hasOwnProperty(n)||(e[n]=r.apply(null,t))}t(n,"indicators/regressions.src.js",[n["parts/Globals.js"],n["parts/Utilities.js"]],function(e,n){var f=n.isArray,t=e.seriesType;t("linearRegression","sma",{params:{xAxisUnit:void 0},tooltip:{valueDecimals:4}},{nameBase:"Linear Regression Indicator",getRegressionLineParameters:function(e,n){for(var t,r,s=this.options.params.index,i=function(e,n){return f(e)?e[n]:e},o=e.reduce(function(e,n){return n+e},0),a=n.reduce(function(e,n){return i(n,s)+e},0),c=o/e.length,u=a/n.length,l=0,p=0,g=0;g<e.length;g++)l+=(t=e[g]-c)*(i(n[g],s)-u),p+=Math.pow(t,2);return{slope:r=p?l/p:0,intercept:u-r*c}},getEndPointY:function(e,n){return e.slope*n+e.intercept},transformXData:function(e,n){var t=e[0];return e.map(function(e){return(e-t)/n})},findClosestDistance:function(e){for(var n,t,r=1;r<e.length-1;r++)0<(n=e[r]-e[r-1])&&(void 0===t||n<t)&&(t=n);return t},getValues:function(e,n){for(var t,r,s,i,o,a,c,u,l=e.xData,p=e.yData,g=n.period,f={xData:[],yData:[],values:[]},h=this.options.params.xAxisUnit||this.findClosestDistance(l),d=g-1;d<=l.length-1;d++)r=d-g+1,s=d+1,i=l[d],a=l.slice(r,s),c=p.slice(r,s),u=this.transformXData(a,h),t=this.getRegressionLineParameters(u,c),o=this.getEndPointY(t,u[u.length-1]),f.values.push({regressionLineParameters:t,x:i,y:o}),f.xData.push(i),f.yData.push(o);return f}}),t("linearRegressionSlope","linearRegression",{},{nameBase:"Linear Regression Slope Indicator",getEndPointY:function(e){return e.slope}}),t("linearRegressionIntercept","linearRegression",{},{nameBase:"Linear Regression Intercept Indicator",getEndPointY:function(e){return e.intercept}}),t("linearRegressionAngle","linearRegression",{tooltip:{pointFormat:'<span style="color:{point.color}">●</span>{series.name}: <b>{point.y}°</b><br/>'}},{nameBase:"Linear Regression Angle Indicator",slopeToAngle:function(e){return Math.atan(e)*(180/Math.PI)},getEndPointY:function(e){return this.slopeToAngle(e.slope)}})}),t(n,"masters/indicators/regressions.src.js",[],function(){})});