Your IP : 3.146.178.241


Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/main/amcharts/4.8.5/plugins/
Upload File :
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/main/amcharts/4.8.5/plugins/regression.js

/**
 * @license
 * Copyright (c) 2018 amCharts (Antanas Marcelionis, Martynas Majeris)
 *
 * This sofware is provided under multiple licenses. Please see below for
 * links to appropriate usage.
 *
 * Free amCharts linkware license. Details and conditions:
 * https://github.com/amcharts/amcharts4/blob/master/LICENSE
 *
 * One of the amCharts commercial licenses. Details and pricing:
 * https://www.amcharts.com/online-store/
 * https://www.amcharts.com/online-store/licenses-explained/
 *
 * If in doubt, contact amCharts at contact@amcharts.com
 *
 * PLEASE DO NOT REMOVE THIS COPYRIGHT NOTICE.
 * @hidden
 */
am4internal_webpackJsonp(["6b72"],{"1NAr":function(t,r,e){var i,n,a;!function(e,o){n=[t],void 0===(a="function"==typeof(i=o)?i.apply(r,n):i)||(t.exports=a)}(0,function(t){"use strict";var r=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};var e={order:2,precision:2,period:null};function i(t,r){var e=[],i=[];t.forEach(function(t,n){null!==t[1]&&(i.push(t),e.push(r[n]))});var n=i.reduce(function(t,r){return t+r[1]},0)/i.length,a=i.reduce(function(t,r){var e=r[1]-n;return t+e*e},0);return 1-i.reduce(function(t,r,i){var n=e[i],a=r[1]-n[1];return t+a*a},0)/a}function n(t,r){var e=Math.pow(10,r);return Math.round(t*e)/e}var a={linear:function(t,r){for(var e=[0,0,0,0,0],a=0,o=0;o<t.length;o++)null!==t[o][1]&&(a++,e[0]+=t[o][0],e[1]+=t[o][1],e[2]+=t[o][0]*t[o][0],e[3]+=t[o][0]*t[o][1],e[4]+=t[o][1]*t[o][1]);var s=a*e[2]-e[0]*e[0],u=a*e[3]-e[0]*e[1],p=0===s?0:n(u/s,r.precision),c=n(e[1]/a-p*e[0]/a,r.precision),l=function(t){return[n(t,r.precision),n(p*t+c,r.precision)]},h=t.map(function(t){return l(t[0])});return{points:h,predict:l,equation:[p,c],r2:n(i(t,h),r.precision),string:0===c?"y = "+p+"x":"y = "+p+"x + "+c}},exponential:function(t,r){for(var e=[0,0,0,0,0,0],a=0;a<t.length;a++)null!==t[a][1]&&(e[0]+=t[a][0],e[1]+=t[a][1],e[2]+=t[a][0]*t[a][0]*t[a][1],e[3]+=t[a][1]*Math.log(t[a][1]),e[4]+=t[a][0]*t[a][1]*Math.log(t[a][1]),e[5]+=t[a][0]*t[a][1]);var o=e[1]*e[2]-e[5]*e[5],s=Math.exp((e[2]*e[3]-e[5]*e[4])/o),u=(e[1]*e[4]-e[5]*e[3])/o,p=n(s,r.precision),c=n(u,r.precision),l=function(t){return[n(t,r.precision),n(p*Math.exp(c*t),r.precision)]},h=t.map(function(t){return l(t[0])});return{points:h,predict:l,equation:[p,c],string:"y = "+p+"e^("+c+"x)",r2:n(i(t,h),r.precision)}},logarithmic:function(t,r){for(var e=[0,0,0,0],a=t.length,o=0;o<a;o++)null!==t[o][1]&&(e[0]+=Math.log(t[o][0]),e[1]+=t[o][1]*Math.log(t[o][0]),e[2]+=t[o][1],e[3]+=Math.pow(Math.log(t[o][0]),2));var s=n((a*e[1]-e[2]*e[0])/(a*e[3]-e[0]*e[0]),r.precision),u=n((e[2]-s*e[0])/a,r.precision),p=function(t){return[n(t,r.precision),n(n(u+s*Math.log(t),r.precision),r.precision)]},c=t.map(function(t){return p(t[0])});return{points:c,predict:p,equation:[u,s],string:"y = "+u+" + "+s+" ln(x)",r2:n(i(t,c),r.precision)}},power:function(t,r){for(var e=[0,0,0,0,0],a=t.length,o=0;o<a;o++)null!==t[o][1]&&(e[0]+=Math.log(t[o][0]),e[1]+=Math.log(t[o][1])*Math.log(t[o][0]),e[2]+=Math.log(t[o][1]),e[3]+=Math.pow(Math.log(t[o][0]),2));var s=(a*e[1]-e[0]*e[2])/(a*e[3]-Math.pow(e[0],2)),u=(e[2]-s*e[0])/a,p=n(Math.exp(u),r.precision),c=n(s,r.precision),l=function(t){return[n(t,r.precision),n(n(p*Math.pow(t,c),r.precision),r.precision)]},h=t.map(function(t){return l(t[0])});return{points:h,predict:l,equation:[p,c],string:"y = "+p+"x^"+c,r2:n(i(t,h),r.precision)}},polynomial:function(t,r){for(var e=[],a=[],o=0,s=0,u=t.length,p=r.order+1,c=0;c<p;c++){for(var l=0;l<u;l++)null!==t[l][1]&&(o+=Math.pow(t[l][0],c)*t[l][1]);e.push(o),o=0;for(var h=[],f=0;f<p;f++){for(var d=0;d<u;d++)null!==t[d][1]&&(s+=Math.pow(t[d][0],c+f));h.push(s),s=0}a.push(h)}a.push(e);for(var v=function(t,r){for(var e=t,i=t.length-1,n=[r],a=0;a<i;a++){for(var o=a,s=a+1;s<i;s++)Math.abs(e[a][s])>Math.abs(e[a][o])&&(o=s);for(var u=a;u<i+1;u++){var p=e[u][a];e[u][a]=e[u][o],e[u][o]=p}for(var c=a+1;c<i;c++)for(var l=i;l>=a;l--)e[l][c]-=e[l][a]*e[a][c]/e[a][a]}for(var h=i-1;h>=0;h--){for(var f=0,d=h+1;d<i;d++)f+=e[d][h]*n[d];n[h]=(e[i][h]-f)/e[h][h]}return n}(a,p).map(function(t){return n(t,r.precision)}),g=function(t){return[n(t,r.precision),n(v.reduce(function(r,e,i){return r+e*Math.pow(t,i)},0),r.precision)]},y=t.map(function(t){return g(t[0])}),_="y = ",m=v.length-1;m>=0;m--)_+=m>1?v[m]+"x^"+m+" + ":1===m?v[m]+"x + ":v[m];return{string:_,points:y,predict:g,equation:[].concat(function(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}(v)).reverse(),r2:n(i(t,y),r.precision)}}};t.exports=Object.keys(a).reduce(function(t,i){return r({_round:n},t,function(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}({},i,function(t,n){return a[i](t,r({},e,n))}))},{})})},oUDf:function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i={};e.d(i,"Regression",function(){return l});var n=e("m4/l"),a=e("1NAr"),o=e("Iz1H"),s=e("aCit"),u=e("o0Lc"),p=e("Qkdp"),c=e("Mtpk"),l=function(t){function r(){var r=t.call(this)||this;return r.events=new u.a,r._method="linear",r._options={},r._simplify=!1,r._reorder=!1,r._skipValidatedEvent=!1,r}return Object(n.c)(r,t),r.prototype.init=function(){t.prototype.init.call(this),this.processSeries()},r.prototype.processSeries=function(){var t=this;this.invalidateData(),this._disposers.push(this.target.events.on("beforedatavalidated",function(r){t._skipValidatedEvent?t._skipValidatedEvent=!1:(t.saveOriginalData(),t.calcData())})),this.target.chart&&this._disposers.push(this.target.chart.events.on("beforedatavalidated",function(r){t.target.invalidateData()})),this.target.adapter.add("data",function(){return void 0===t._data&&t.calcData(),t._data}),this.saveOriginalData()},r.prototype.saveOriginalData=function(){this.target.adapter.disableKey("data"),this.target.data&&this.target.data.length&&(this._originalData=this.target.data),this.target.adapter.enableKey("data")},r.prototype.invalidateData=function(){this._data=void 0},r.prototype.calcData=function(){this._data=[];var t=this.target,r=this._originalData;r&&0!=r.length||(r=this.target.baseSprite.data);for(var e=[],i={},n=0,o=0;o<r.length;o++){var s=t.dataFields.valueX?r[o][t.dataFields.valueX]:o,u=t.dataFields.valueY?r[o][t.dataFields.valueY]:o;c.hasValue(s)&&c.hasValue(u)&&(e.push([s,u]),i[n]=o,n++)}var l=[];switch(this.method){case"polynomial":l=a.polynomial(e,this.options);break;default:l=a.linear(e,this.options)}this.result=l,this.events.dispatchImmediately("processed",{type:"processed",target:this}),this.reorder&&l.points.sort(function(t,r){return t[0]>r[0]?-1:t[0]<r[0]?1:0}),this._data=[];var h,f=function(t){d.simplify&&t&&(t=l.points.length-1);var e={},n=i[t];p.each(d.target.dataFields,function(i,a){e[a]="valueX"==i?l.points[t][0]:"valueY"==i?l.points[t][1]:r[n][a]}),d._data.push(e),h=t},d=this;for(o=0;o<l.points.length;o++)f(o),o=h},Object.defineProperty(r.prototype,"method",{get:function(){return this._method},set:function(t){this._method!=t&&(this._method=t,this.invalidateData())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"options",{get:function(){return this._options},set:function(t){this._options!=t&&(this._options=t,this.invalidateData())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"simplify",{get:function(){return this._simplify},set:function(t){this._simplify!=t&&(this._simplify=t,this.invalidateData())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"reorder",{get:function(){return this._reorder},set:function(t){this._reorder!=t&&(this._reorder=t,this.invalidateData())},enumerable:!0,configurable:!0}),r}(o.a);s.c.registeredClasses.Regression=l,window.am4plugins_regression=i}},["oUDf"]);
//# sourceMappingURL=regression.js.map