Showing content from https://pomgui.github.io/chartjs-plugin-regression/dist/chartjs-plugin-regression-0.2.1.js below:
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MetaDataSet=void 0;var r=n(1),i=function(){function t(t,e){this.getXY=void 0,this.isXY=!1;var n=e.regressions;this.chart=t,this.dataset=e,this.normalizedData=this._normalizeData(e.data),this.sections=this._createMetaSections(n),this._calculate()}return t.prototype._normalizeData=function(t){var e=this;return t.map((function(t,n){var r;return"number"==typeof t||null==t||void 0===t?r=[n,t]:(e.isXY=!0,r=[t.x,t.y]),r}))},t.prototype._createMetaSections=function(t){var e=this;return(t.sections||[{startIndex:0,endIndex:this.dataset.data.length-1}]).map((function(t){return new r.MetaSection(t,e)}))},t.prototype._calculate=function(){this.sections.forEach((function(t){return t.calculate()}))},t.prototype.adjustScales=function(){if(void 0===this.topY){var t,e,n=this.chart.scales;Object.keys(n).forEach((function(r){return"x"==r[0]&&(t=n[r])||(e=n[r])})),this.topY=e.top,this.bottomY=e.bottom,this.getXY=function(n,r){return{x:t.getPixelForValue(n,void 0,void 0,!0),y:e.getPixelForValue(r)}}}},t.prototype.drawRegressions=function(){var t=this.chart.chart.ctx;t.save();try{this.sections.forEach((function(e){return e.drawRegressions(t)}))}finally{t.restore()}},t.prototype.drawRightBorders=function(){var t=this.chart.chart.ctx;t.save();try{for(var e=0;e 1&&this.type.includes("copy"))throw Error("Invalid regression type:"+this.type+'. "none" cannot be combined with other type!')},t.prototype.calculate=function(){var t=this._meta.normalizedData.slice(this.startIndex,this.endIndex+1);"copy"==this.type[0]?this._calculateCopySection(t):this._calculateBestR2(t)},t.prototype._calculateBestR2=function(t){var e=this;this.result=this.type.reduce((function(n,i){var o=Object.assign({},e.calculation),a=i;/polynomial[34]$/.test(i)&&(o.order=parseInt(i.substr(10)),a=i.substr(0,10));var s=r[a](t,o);return s.type=i,!n||n.r2 n.endIndex)&&("all"==i||"last"==i&&l==e.endIndex||"empty"==i&&!o[l])&&(e.copy.maxValue&&(u=Math.min(e.copy.maxValue,u)),void 0!==e.copy.minValue&&(u=Math.max(e.copy.minValue,u)),a[l]=s?{x:c,y:u}:u)}))}},t.prototype.drawRightBorder=function(t){t.beginPath(),this._setLineAttrs(t),t.setLineDash([10,2]),t.lineWidth=2;var e=this._meta.getXY(this.endIndex,0);t.moveTo(e.x,this._meta.topY),t.lineTo(e.x,this._meta.bottomY),t.fillStyle=this.line.color,t.fillText(this.label,e.x,this._meta.topY),t.stroke()},t.prototype.drawRegressions=function(t){for(var e=0,n=this._meta.sections.length;e Math.abs(n[o][a])&&(a=s);for(var c=o;c =o;p--)n[p][l]-=n[p][o]*n[o][l]/n[o][o]}for(var h=r-1;h>=0;h--){for(var f=0,d=h+1;d =0;m--)b+=m>1?v[m]+"x^"+m+" + ":1===m?v[m]+"x + ":v[m];return{string:b,points:x,predict:g,equation:[].concat(n(v)).reverse(),r2:o(i(t,x),e.precision)}}};t.exports=Object.keys(a).reduce((function(t,n){return e({_round:o},t,(c=function(t,i){return a[n](t,e({},r,i))},(s=n)in(i={})?Object.defineProperty(i,s,{value:c,enumerable:!0,configurable:!0,writable:!0}):i[s]=c,i));var i,s,c}),{})})?r.apply(e,i):r)||(t.exports=o)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ChartRegressions=void 0;var r=n(0),i={},o=0,a=function(){function t(){this.id="regressions"}return t.prototype.beforeInit=function(t){t.$$id=++o},t.prototype.beforeUpdate=function(t,e){var n,o,a,c=(n=t.config.options)&&(o=n.plugins)&&(a=o.regressions)&&a.onCompleteCalculation;s(t,(function(e,n,o){n=new r.MetaDataSet(t,e);var a=1e3*t.$$id+o;i[a]=n})),c&&c(t)},t.prototype.beforeRender=function(t,e){s(t,(function(t,e){return e.adjustScales()}))},t.prototype.beforeDatasetsDraw=function(t,e,n){s(t,(function(t,e){return e.drawRightBorders()}))},t.prototype.afterDatasetsDraw=function(t,e,n){s(t,(function(t,e){return e.drawRegressions()}))},t.prototype.destroy=function(t){Object.keys(i).filter((function(e){return e/1e3>>0==t.$$id})).forEach((function(t){return delete i[t]}))},t.prototype.getDataset=function(t,e){var n=1e3*t.$$id+e;return i[n]},t.prototype.getSections=function(t,e){var n=this.getDataset(t,e);return n&&n.sections},t}();function s(t,n){t.data.datasets.forEach((function(r,i){if(r.regressions&&t.isDatasetVisible(i)){var o=e.ChartRegressions.getDataset(t,i);n(r,o,i)}}))}e.ChartRegressions=new a,window.ChartRegressions=e.ChartRegressions}]);
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4