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

9 lines
1.9 KiB
JavaScript

!/**
* Highstock JS v11.4.1 (2024-04-04)
*
* Indicator series type for Highcharts Stock
*
* (c) 2010-2024 Kacper Madej
*
* 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/zigzag",["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,s){e.hasOwnProperty(t)||(e[t]=s.apply(null,i),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:t,module:e[t]}})))}i(t,"Stock/Indicators/Zigzag/ZigzagIndicator.js",[t["Core/Series/SeriesRegistry.js"],t["Core/Utilities.js"]],function(e,t){let{sma:i}=e.seriesTypes,{merge:s,extend:o}=t;class n extends i{getValues(e,t){let i=t.lowIndex,s=t.highIndex,o=t.deviation/100,n={low:1+o,high:1-o},a=e.xData,r=e.yData,h=r?r.length:0,u=[],d=[],l=[],g,p,c,f,m=!1,v=!1;if(!a||a.length<=1||h&&(void 0===r[0][i]||void 0===r[0][s]))return;let y=r[0][i],x=r[0][s];for(g=1;g<h;g++)r[g][i]<=x*n.high?(u.push([a[0],x]),c=[a[g],r[g][i]],f=!0,m=!0):r[g][s]>=y*n.low&&(u.push([a[0],y]),c=[a[g],r[g][s]],f=!1,m=!0),m&&(d.push(u[0][0]),l.push(u[0][1]),p=g++,g=h);for(g=p;g<h;g++)f?(r[g][i]<=c[1]&&(c=[a[g],r[g][i]]),r[g][s]>=c[1]*n.low&&(v=s)):(r[g][s]>=c[1]&&(c=[a[g],r[g][s]]),r[g][i]<=c[1]*n.high&&(v=i)),!1!==v&&(u.push(c),d.push(c[0]),l.push(c[1]),c=[a[g],r[g][v]],f=!f,v=!1);let w=u.length;return 0!==w&&u[w-1][0]<a[h-1]&&(u.push(c),d.push(c[0]),l.push(c[1])),{values:u,xData:d,yData:l}}}return n.defaultOptions=s(i.defaultOptions,{params:{index:void 0,period:void 0,lowIndex:2,highIndex:1,deviation:1}}),o(n.prototype,{nameComponents:["deviation"],nameSuffixes:["%"],nameBase:"Zig Zag"}),e.registerSeriesType("zigzag",n),n}),i(t,"masters/indicators/zigzag.src.js",[t["Core/Globals.js"]],function(e){return e})});