Icard/angular-clarity-master(work.../node_modules/highcharts/indicators/klinger.js

9 lines
5.6 KiB
JavaScript
Raw Normal View History

2024-07-16 14:55:36 +00:00
!/**
* Highcharts Stock JS v11.4.1 (2024-04-04)
*
* Indicator series type for Highcharts Stock
*
* (c) 2010-2024 Karol Kolodziej
*
* License: www.highcharts.com/license
*/function(e){"object"==typeof module&&module.exports?(e.default=e,module.exports=e):"function"==typeof define&&define.amd?define("highcharts/indicators/klinger",["highcharts","highcharts/modules/stock"],function(t){return e(t),e.Highcharts=t,e}):e("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(e){"use strict";var t=e?e._modules:{};function i(e,t,i,o){e.hasOwnProperty(t)||(e[t]=o.apply(null,i),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:t,module:e[t]}})))}i(t,"Stock/Indicators/MultipleLinesComposition.js",[t["Core/Series/SeriesRegistry.js"],t["Core/Utilities.js"]],function(e,t){var i;let{sma:{prototype:o}}=e.seriesTypes,{defined:s,error:r,merge:a}=t;return function(e){let t=["bottomLine"],i=["top","bottom"],n=["top"];function l(e){return"plot"+e.charAt(0).toUpperCase()+e.slice(1)}function p(e,t){let i=[];return(e.pointArrayMap||[]).forEach(e=>{e!==t&&i.push(l(e))}),i}function h(){let e=this,t=e.pointValKey,i=e.linesApiNames,n=e.areaLinesNames,h=e.points,u=e.options,c=e.graph,g={options:{gapSize:u.gapSize}},d=[],f=p(e,t),m=h.length,y;if(f.forEach((e,t)=>{for(d[t]=[];m--;)y=h[m],d[t].push({x:y.x,plotX:y.plotX,plotY:y[e],isNull:!s(y[e])});m=h.length}),e.userOptions.fillColor&&n.length){let t=d[f.indexOf(l(n[0]))],i=1===n.length?h:d[f.indexOf(l(n[1]))],s=e.color;e.points=i,e.nextPoints=t,e.color=e.userOptions.fillColor,e.options=a(h,g),e.graph=e.area,e.fillGraph=!0,o.drawGraph.call(e),e.area=e.graph,delete e.nextPoints,delete e.fillGraph,e.color=s}i.forEach((t,i)=>{d[i]?(e.points=d[i],u[t]?e.options=a(u[t].styles,g):r('Error: "There is no '+t+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),e.graph=e["graph"+t],o.drawGraph.call(e),e["graph"+t]=e.graph):r('Error: "'+t+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),e.points=h,e.options=u,e.graph=c,o.drawGraph.call(e)}function u(e){let t,i=[],s=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((t=o.getGraphPath.call(this,this.nextPoints))&&t.length){t[0][0]="L",i=o.getGraphPath.call(this,e),s=t.slice(0,i.length);for(let e=s.length-1;e>=0;e--)i.push(s[e])}}else i=o.getGraphPath.apply(this,arguments);return i}function c(e){let t=[];return(this.pointArrayMap||[]).forEach(i=>{t.push(e[i])}),t}function g(){let e=this.pointArrayMap,t=[],i;t=p(this),o.translate.apply(this,arguments),this.points.forEach(o=>{e.forEach((e,s)=>{i=o[e],this.dataModify&&(i=this.dataModify.modifyValue(i)),null!==i&&(o[t[s]]=this.yAxis.toPixels(i,!0))})})}e.compose=function(e){let o=e.prototype;return o.linesApiNames=o.linesApiNames||t.slice(),o.pointArrayMap=o.pointArrayMap||i.slice(),o.pointValKey=o.pointValKey||"top",o.areaLinesNames=o.areaLinesNames||n.slice(),o.drawGraph=h,o.getGraphPath=u,o.toYData=c,o.translate=g,e}}(i||(i={})),i}),i(t,"Stock/Indicators/Klinger/KlingerIndicator.js",[t["Stock/Indicators/MultipleLinesComposition.js"],t["Core/Series/SeriesRegistry.js"],t["Core/Utilities.js"]],function(e,t,i){let{ema:o,sma:s}=t.seriesTypes,{correctFloat:r,error:a,extend:n,isArray:l,merge:p}=i;class h extends s{calculateTrend(e,t){return e[t][1]+e[t][2]+e[t][3]>e[t-1][1]+e[t-1][2]+e[t-1][3]?1:-1}isValidData(e){let t=this.chart,i=this.options,o=this.linkedParent,s=l(e)&&4===e.length,r=this.volumeSeries||(this.volumeSeries=t.get(i.params.volumeSeriesID));return r||a("Series "+i.params.volumeSeriesID+" not found! Check `volumeSeriesID`.",!0,o.chart),!!([o,r].every(function(e){return e&&e.xData&&e.xData.length>=i.params.slowAvgPeriod})&&s)}getCM(e,t,i,o,s){return r(t+(i===o?e:s))}getDM(e,t){return r(e-t)}getVolumeForce(e){let t=[],i=0,o,s=1,r=0,a=e[0][1]-e[0][2],n=0,l;for(;s<e.length;s++)l=this.calculateTrend(e,s),o=this.getDM(e[s][1],e[s][2]),i=this.getCM(r,o,l,n,a),t.push([this.volumeSeries.yData[s]*l*Math.abs(2*(o/i-1))*100]),n=l,r=i,a=o;return t}getEMA(e,t,i,s,r,a,n){return o.prototype.calculateEma(n||[],e,void 0===a?1:a,s,t,void 0===r?-1:r,i)}getSMA(e,t,i){return o.prototype.accumulatePeriodPoints(e,t,i)/e}getV