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

9 lines
4.7 KiB
JavaScript

!/**
* Highstock JS v11.4.1 (2024-04-04)
*
* Indicator series type for Highcharts Stock
*
* (c) 2010-2024 Paweł Fus
*
* License: www.highcharts.com/license
*/function(t){"object"==typeof module&&module.exports?(t.default=t,module.exports=t):"function"==typeof define&&define.amd?define("highcharts/indicators/bollinger-bands",["highcharts","highcharts/modules/stock"],function(e){return t(e),t.Highcharts=e,t}):t("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(t){"use strict";var e=t?t._modules:{};function i(t,e,i,o){t.hasOwnProperty(e)||(t[e]=o.apply(null,i),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:e,module:t[e]}})))}i(e,"Stock/Indicators/MultipleLinesComposition.js",[e["Core/Series/SeriesRegistry.js"],e["Core/Utilities.js"]],function(t,e){var i;let{sma:{prototype:o}}=t.seriesTypes,{defined:s,error:n,merge:a}=e;return function(t){let e=["bottomLine"],i=["top","bottom"],r=["top"];function l(t){return"plot"+t.charAt(0).toUpperCase()+t.slice(1)}function p(t,e){let i=[];return(t.pointArrayMap||[]).forEach(t=>{t!==e&&i.push(l(t))}),i}function h(){let t=this,e=t.pointValKey,i=t.linesApiNames,r=t.areaLinesNames,h=t.points,c=t.options,d=t.graph,u={options:{gapSize:c.gapSize}},f=[],m=p(t,e),y=h.length,g;if(m.forEach((t,e)=>{for(f[e]=[];y--;)g=h[y],f[e].push({x:g.x,plotX:g.plotX,plotY:g[t],isNull:!s(g[t])});y=h.length}),t.userOptions.fillColor&&r.length){let e=f[m.indexOf(l(r[0]))],i=1===r.length?h:f[m.indexOf(l(r[1]))],s=t.color;t.points=i,t.nextPoints=e,t.color=t.userOptions.fillColor,t.options=a(h,u),t.graph=t.area,t.fillGraph=!0,o.drawGraph.call(t),t.area=t.graph,delete t.nextPoints,delete t.fillGraph,t.color=s}i.forEach((e,i)=>{f[i]?(t.points=f[i],c[e]?t.options=a(c[e].styles,u):n('Error: "There is no '+e+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),t.graph=t["graph"+e],o.drawGraph.call(t),t["graph"+e]=t.graph):n('Error: "'+e+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),t.points=h,t.options=c,t.graph=d,o.drawGraph.call(t)}function c(t){let e,i=[],s=[];if(t=t||this.points,this.fillGraph&&this.nextPoints){if((e=o.getGraphPath.call(this,this.nextPoints))&&e.length){e[0][0]="L",i=o.getGraphPath.call(this,t),s=e.slice(0,i.length);for(let t=s.length-1;t>=0;t--)i.push(s[t])}}else i=o.getGraphPath.apply(this,arguments);return i}function d(t){let e=[];return(this.pointArrayMap||[]).forEach(i=>{e.push(t[i])}),e}function u(){let t=this.pointArrayMap,e=[],i;e=p(this),o.translate.apply(this,arguments),this.points.forEach(o=>{t.forEach((t,s)=>{i=o[t],this.dataModify&&(i=this.dataModify.modifyValue(i)),null!==i&&(o[e[s]]=this.yAxis.toPixels(i,!0))})})}t.compose=function(t){let o=t.prototype;return o.linesApiNames=o.linesApiNames||e.slice(),o.pointArrayMap=o.pointArrayMap||i.slice(),o.pointValKey=o.pointValKey||"top",o.areaLinesNames=o.areaLinesNames||r.slice(),o.drawGraph=h,o.getGraphPath=c,o.toYData=d,o.translate=u,t}}(i||(i={})),i}),i(e,"Stock/Indicators/BB/BBIndicator.js",[e["Stock/Indicators/MultipleLinesComposition.js"],e["Core/Series/SeriesRegistry.js"],e["Core/Utilities.js"]],function(t,e,i){let{sma:o}=e.seriesTypes,{extend:s,isArray:n,merge:a}=i;class r extends o{init(){e.seriesTypes.sma.prototype.init.apply(this,arguments),this.options=a({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(t,i){let o,s,a,r,l,p,h,c,d;let u=i.period,f=i.standardDeviation,m=[],y=[],g=t.xData,b=t.yData,x=b?b.length:0,C=[];if(g.length<u)return;let v=n(b[0]);for(d=u;d<=x;d++)l=g.slice(d-u,d),p=b.slice(d-u,d),r=(c=e.seriesTypes.sma.prototype.getValues.call(this,{xData:l,yData:p},i)).xData[0],o=c.yData[0],h=function(t,e,i,o){let s=t.length,n=0,a,r=0;for(;n<s;n++)r+=(a=(i?t[n][e]:t[n])-o)*a;return Math.sqrt(r/=s-1)}(p,i.index,v,o),s=o+f*h,a=o-f*h,C.push([r,s,o,a]),m.push(r),y.push([s,o,a]);return{values:C,xData:m,yData:y}}}return r.defaultOptions=a(o.defaultOptions,{params:{period:20,standardDeviation:2,index:3},bottomLine:{styles:{lineWidth:1,lineColor:void 0}},topLine:{styles:{lineWidth:1,lineColor:void 0}},tooltip:{pointFormat:'<span style="color:{point.color}">●</span><b> {series.name}</b><br/>Top: {point.top}<br/>Middle: {point.middle}<br/>Bottom: {point.bottom}<br/>'},marker:{enabled:!1},dataGrouping:{approximation:"averages"}}),s(r.prototype,{areaLinesNames:["top","bottom"],linesApiNames:["topLine","bottomLine"],nameComponents:["period","standardDeviation"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),t.compose(r),e.registerSeriesType("bb",r),r}),i(e,"masters/indicators/bollinger-bands.src.js",[e["Core/Globals.js"]],function(t){return t})});