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

9 lines
3.8 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/pivot-points",["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 a(t,e,a,o){t.hasOwnProperty(e)||(t[e]=o.apply(null,a),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:e,module:t[e]}})))}a(e,"Stock/Indicators/PivotPoints/PivotPointsPoint.js",[e["Core/Series/SeriesRegistry.js"]],function(t){let e=t.seriesTypes.sma.prototype.pointClass;function a(e,a){let o=e.series.pointArrayMap,n,s=o.length;for(t.seriesTypes.sma.prototype.pointClass.prototype[a].call(e);s--;)e[n="dataLabel"+o[s]]&&e[n].element&&e[n].destroy(),e[n]=null}return class extends e{destroyElements(){a(this,"destroyElements")}destroy(){a(this,"destroyElements")}}}),a(e,"Stock/Indicators/PivotPoints/PivotPointsIndicator.js",[e["Stock/Indicators/PivotPoints/PivotPointsPoint.js"],e["Core/Series/SeriesRegistry.js"],e["Core/Utilities.js"]],function(t,e,a){let{sma:o}=e.seriesTypes,{merge:n,extend:s,defined:i,isArray:l}=a;class r extends o{toYData(t){return[t.P]}translate(){let t=this;super.translate.apply(t),t.points.forEach(function(e){t.pointArrayMap.forEach(function(a){i(e[a])&&(e["plot"+a]=t.yAxis.toPixels(e[a],!0))})}),t.plotEndPoint=t.xAxis.toPixels(t.endPoint,!0)}getGraphPath(t){let e=this,a=[[],[],[],[],[],[],[],[],[]],o=e.pointArrayMap.length,n=e.plotEndPoint,s=[],l,r,p=t.length,d;for(;p--;){for(d=0,r=t[p];d<o;d++)i(r[l=e.pointArrayMap[d]])&&a[d].push({plotX:r.plotX,plotY:r["plot"+l],isNull:!1},{plotX:n,plotY:r["plot"+l],isNull:!1},{plotX:n,plotY:null,isNull:!0});n=r.plotX}return a.forEach(t=>{s=s.concat(super.getGraphPath.call(e,t))}),s}drawDataLabels(){let t,e,a,o;let n=this,s=n.pointArrayMap;n.options.dataLabels.enabled&&(e=n.points.length,s.concat([!1]).forEach((i,l)=>{for(o=e;o--;)a=n.points[o],i?(a.y=a[i],a.pivotLine=i,a.plotY=a["plot"+i],t=a["dataLabel"+i],l&&(a["dataLabel"+s[l-1]]=a.dataLabel),a.dataLabels||(a.dataLabels=[]),a.dataLabels[0]=a.dataLabel=t=t&&t.element?t:null):a["dataLabel"+s[l-1]]=a.dataLabel;super.drawDataLabels.call(n)}))}getValues(t,e){let a,o,n,s,i,r,p;let d=e.period,u=t.xData,c=t.yData,h=c?c.length:0,f=this[e.algorithm+"Placement"],P=[],y=[],m=[];if(!(u.length<d)&&l(c[0])&&4===c[0].length){for(p=d+1;p<=h+d;p+=d)n=u.slice(p-d-1,p),s=c.slice(p-d-1,p),o=n.length,a=n[o-1],r=f(this.getPivotAndHLC(s)),i=P.push([a].concat(r)),y.push(a),m.push(P[i-1].slice(1));return this.endPoint=n[0]+(a-n[0])/o*d,{values:P,xData:y,yData:m}}}getPivotAndHLC(t){let e=t[t.length-1][3],a=-1/0,o=1/0;return t.forEach(function(t){a=Math.max(a,t[1]),o=Math.min(o,t[2])}),[(a+o+e)/3,a,o,e]}standardPlacement(t){let e=t[1]-t[2];return[null,null,t[0]+e,2*t[0]-t[2],t[0],2*t[0]-t[1],t[0]-e,null,null]}camarillaPlacement(t){let e=t[1]-t[2];return[t[3]+1.5*e,t[3]+1.25*e,t[3]+1.1666*e,t[3]+1.0833*e,t[0],t[3]-1.0833*e,t[3]-1.1666*e,t[3]-1.25*e,t[3]-1.5*e]}fibonacciPlacement(t){let e=t[1]-t[2];return[null,t[0]+e,t[0]+.618*e,t[0]+.382*e,t[0],t[0]-.382*e,t[0]-.618*e,t[0]-e,null]}}return r.defaultOptions=n(o.defaultOptions,{params:{index:void 0,period:28,algorithm:"standard"},marker:{enabled:!1},enableMouseTracking:!1,dataLabels:{enabled:!0,format:"{point.pivotLine}"},dataGrouping:{approximation:"averages"}}),s(r.prototype,{nameBase:"Pivot Points",pointArrayMap:["R4","R3","R2","R1","P","S1","S2","S3","S4"],pointValKey:"P",pointClass:t}),e.registerSeriesType("pivotpoints",r),r}),a(e,"masters/indicators/pivot-points.src.js",[e["Core/Globals.js"]],function(t){return t})});