Icard/angular-clarity-master(work.../node_modules/highcharts/indicators/ichimoku-kinko-hyo.js

9 lines
6.9 KiB
JavaScript
Raw Permalink Normal View History

2024-07-16 14:55:36 +00:00
!/**
* Highstock JS v11.4.1 (2024-04-04)
*
* Indicator series type for Highcharts Stock
*
* (c) 2010-2024 Sebastian Bochan
*
* License: www.highcharts.com/license
*/function(o){"object"==typeof module&&module.exports?(o.default=o,module.exports=o):"function"==typeof define&&define.amd?define("highcharts/indicators/ichimoku-kinko-hyo",["highcharts","highcharts/modules/stock"],function(t){return o(t),o.Highcharts=t,o}):o("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(o){"use strict";var t=o?o._modules:{};function e(o,t,e,n){o.hasOwnProperty(t)||(o[t]=n.apply(null,e),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:t,module:o[t]}})))}e(t,"Stock/Indicators/IKH/IKHIndicator.js",[t["Extensions/DataGrouping/ApproximationRegistry.js"],t["Core/Color/Color.js"],t["Core/Series/SeriesRegistry.js"],t["Core/Utilities.js"]],function(o,t,e,n){let{parse:i}=t,{sma:s}=e.seriesTypes,{defined:p,extend:l,isArray:a,isNumber:r,getClosestDistance:h,merge:u,objectEach:c}=n;function k(o){return{high:o.reduce(function(o,t){return Math.max(o,t[1])},-1/0),low:o.reduce(function(o,t){return Math.min(o,t[2])},1/0)}}function g(o){let t=o.indicator;t.points=o.points,t.nextPoints=o.nextPoints,t.color=o.color,t.options=u(o.options.senkouSpan.styles,o.gap),t.graph=o.graph,t.fillGraph=!0,e.seriesTypes.sma.prototype.drawGraph.call(t)}class d extends s{constructor(){super(...arguments),this.data=[],this.options={},this.points=[],this.graphCollection=[]}init(){super.init.apply(this,arguments),this.options=u({tenkanLine:{styles:{lineColor:this.color}},kijunLine:{styles:{lineColor:this.color}},chikouLine:{styles:{lineColor:this.color}},senkouSpanA:{styles:{lineColor:this.color,fill:i(this.color).setOpacity(.5).get()}},senkouSpanB:{styles:{lineColor:this.color,fill:i(this.color).setOpacity(.5).get()}},senkouSpan:{styles:{fill:i(this.color).setOpacity(.2).get()}}},this.options)}toYData(o){return[o.tenkanSen,o.kijunSen,o.chikouSpan,o.senkouSpanA,o.senkouSpanB]}translate(){for(let o of(e.seriesTypes.sma.prototype.translate.apply(this),this.points))for(let t of this.pointArrayMap){let e=o[t];r(e)&&(o["plot"+t]=this.yAxis.toPixels(e,!0),o.plotY=o["plot"+t],o.tooltipPos=[o.plotX,o["plot"+t]],o.isNull=!1)}}drawGraph(){let o=this,t=o.points,n=o.options,i=o.graph,s=o.color,l={options:{gapSize:n.gapSize}},a=o.pointArrayMap.length,r=[[],[],[],[],[],[]],h={tenkanLine:r[0],kijunLine:r[1],chikouLine:r[2],senkouSpanA:r[3],senkouSpanB:r[4],senkouSpan:r[5]},k=[],d=o.options.senkouSpan,f=d.color||d.styles.fill,S=d.negativeColor,y=[[],[]],m=[[],[]],C=t.length,v=0,A,x,Y,P,B,j,G,N,X,b,T,w,E;for(o.ikhMap=h;C--;){for(Y=0,x=t[C];Y<a;Y++)p(x[A=o.pointArrayMap[Y]])&&r[Y].push({plotX:x.plotX,plotY:x["plot"+A],isNull:!1});if(S&&C!==t.length-1){let o=h.senkouSpanB.length-1,t=function(o,t,e,n){if(o&&t&&e&&n){let i=t.plotX-o.plotX,s=t.plotY-o.plotY,p=n.plotX-e.plotX,l=n.plotY-e.plotY,a=o.plotX-e.plotX,r=o.plotY-e.plotY,h=(-s*a+i*r)/(-p*s+i*l),u=(p*r-l*a)/(-p*s+i*l);if(h>=0&&h<=1&&u>=0&&u<=1)return{plotX:o.plotX+u*i,plotY:o.plotY+u*s}}}(h.senkouSpanA[o-1],h.senkouSpanA[o],h.senkouSpanB[o-1],h.senkouSpanB[o]);if(t){let e={plotX:t.plotX,plotY:t.plotY,isNull:!1,intersectPoint:!0};h.senkouSpanA.splice(o,0,e),h.senkouSpanB.splice(o,0,e),k.push(o)}}}if(c(h,(t,i)=>{n[i]&&"senkouSpan"!==i&&(o.points=r[v],o.options=u(n[i].styles,l),o.graph=o["graph"+i],o.fillGraph=!1,o.color=s,e.seriesTypes.sma.prototype.drawGraph.call(o),o["graph"+i]=o.graph),v++}),o.graphCollection)for(let t of o.graphCollection)o[t].destroy(),delete o[t];if(o.graphCollection=[],S&&h.senkouSpanA[0]&&h.senkouSpanB[0]){for(k.unshift(0),k.push(h.senkouSpanA.length-1),w=0;w<k.length-1;w++)if(P=k[w],B=k[w+1],j=h.senkouSpanB.slice(P,B+1),G=h.senkouSpanA.slice(P,B+1),Math.floor(j.length/2)>=1){let o=Math.floor(j.length/2);if(j[o].plotY===G[o].plotY){for(E=0,N=0,X=0;E<j.length;E++)N+=j[E].plotY,X+=G[E].plotY;y[T=N>X?0:1]=y[T].concat(j),m[T]=m[T].concat(G)}else y[T=j[o].plotY>G[o].plotY?0:1]=y[T].concat(j),m[T]=m[T].concat(G)}else y[T=j[0].plotY>G[0].plotY?0:1]=y[T].concat(j),m[T]=m[T].concat(G);["graphsenkouSpanColor","graphsenkouSpanNegativeColor"].forEach(function(t,e){y[e].length&&m[e].length&&(b=0===e?f:S,g({indicator:o,points: