UNPKG

highcharts

Version:
14 lines 3.13 kB
!/** * Highstock JS v12.6.0 (2026-04-13) * @module highcharts/indicators/zigzag * @requires highcharts * @requires highcharts/modules/stock * * Indicator series type for Highcharts Stock * * (c) 2010-2026 Highsoft AS * Author: Kacper Madej * * A commercial license may be required depending on use. * See www.highcharts.com/license */function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(e._Highcharts,e._Highcharts.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/indicators/zigzag",["highcharts/highcharts"],function(e){return t(e,e.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/indicators/zigzag"]=t(e._Highcharts,e._Highcharts.SeriesRegistry):e.Highcharts=t(e.Highcharts,e.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(e,t)=>(()=>{"use strict";var r={512:e=>{e.exports=t},944:t=>{t.exports=e}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};i.d(n,{default:()=>y});var a=i(944),s=i.n(a),h=i(512),p=i.n(h);let{doc:u,win:c}=s();function l(e){return f(e)&&"number"==typeof e.nodeType}function f(e,t){let r;return!!e&&"object"==typeof e&&(!t||"[object Array]"!==(r=Object.prototype.toString.call(e))&&"[object Array Iterator]"!==r)}Array.prototype.find;let{sma:d}=p().seriesTypes;class g extends d{getValues(e,t){let r=t.lowIndex,o=t.highIndex,i=t.deviation/100,n={low:1+i,high:1-i},a=e.xData,s=e.yData,h=s?s.length:0,p=[],u=[],c=[],l,f,d,g,y=!1,x=!1;if(!a||a.length<=1||h&&(void 0===s[0][r]||void 0===s[0][o]))return;let v=s[0][r],b=s[0][o];for(l=1;l<h;l++)s[l][r]<=b*n.high?(p.push([a[0],b]),d=[a[l],s[l][r]],g=!0,y=!0):s[l][o]>=v*n.low&&(p.push([a[0],v]),d=[a[l],s[l][o]],g=!1,y=!0),y&&(u.push(p[0][0]),c.push(p[0][1]),f=l++,l=h);for(l=f;l<h;l++)g?(s[l][r]<=d[1]&&(d=[a[l],s[l][r]]),s[l][o]>=d[1]*n.low&&(x=o)):(s[l][o]>=d[1]&&(d=[a[l],s[l][o]]),s[l][r]<=d[1]*n.high&&(x=r)),!1!==x&&(p.push(d),u.push(d[0]),c.push(d[1]),d=[a[l],s[l][x]],g=!g,x=!1);let m=p.length;return 0!==m&&p[m-1][0]<a[h-1]&&(p.push(d),u.push(d[0]),c.push(d[1])),{values:p,xData:u,yData:c}}}g.defaultOptions=function(e,...t){let r,o=[e,...t],i={},n=function(e,t){return"object"!=typeof e&&(e={}),function(e,t,r){for(let r in e)Object.hasOwnProperty.call(e,r)&&t.call((0,e[r]),e[r],r,e)}(t,function(r,o){if("__proto__"!==o&&"constructor"!==o){let i;!f(r,!0)||(i=r?.constructor,f(r,!0)&&!l(r)&&i?.name&&"Object"!==i.name)||l(r)?e[o]=t[o]:e[o]=n(e[o]||{},r)}}),e};!0===e&&(i=o[1],o=Array.prototype.slice.call(o,2));let a=o.length;for(r=0;r<a;r++)i=n(i,o[r]);return i}(d.defaultOptions,{params:{index:void 0,period:void 0,lowIndex:2,highIndex:1,deviation:1}}),function(e,t){let r;for(r in e||(e={}),t)e[r]=t[r]}(g.prototype,{nameComponents:["deviation"],nameSuffixes:["%"],nameBase:"Zig Zag"}),p().registerSeriesType("zigzag",g);let y=s();return n.default})());