UNPKG

highcharts

Version:
14 lines 5.66 kB
!/** * Highstock JS v12.6.0 (2026-04-13) * @module highcharts/indicators/price-envelopes * @requires highcharts * @requires highcharts/modules/stock * * Indicator series type for Highcharts Stock * * (c) 2010-2026 Highsoft AS * Author: Paweł Fus * * A commercial license may be required depending on use. * See www.highcharts.com/license */function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(t._Highcharts,t._Highcharts.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/indicators/price-envelopes",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/indicators/price-envelopes"]=e(t._Highcharts,t._Highcharts.SeriesRegistry):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(t,e)=>(()=>{"use strict";var o,r={512:t=>{t.exports=e},944:e=>{e.exports=t}},i={};function n(t){var e=i[t];if(void 0!==e)return e.exports;var o=i[t]={exports:{}};return r[t](o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var a={};n.d(a,{default:()=>v});var s=n(944),p=n.n(s),l=n(512),h=n.n(l);let{doc:c,win:u}=p();function f(t){return d(t)&&"number"==typeof t.nodeType}function y(t){let e=Object.prototype.toString.call(t);return"[object Array]"===e||"[object Array Iterator]"===e}function d(t,e){return!!t&&"object"==typeof t&&(!e||!y(t))}function m(t,...e){let o,r=[t,...e],i={},n=function(t,e){return"object"!=typeof t&&(t={}),function(t,e,o){for(let o in t)Object.hasOwnProperty.call(t,o)&&e.call((0,t[o]),t[o],o,t)}(e,function(o,r){if("__proto__"!==r&&"constructor"!==r){let i;!d(o,!0)||(i=o?.constructor,d(o,!0)&&!f(o)&&i?.name&&"Object"!==i.name)||f(o)?t[r]=e[r]:t[r]=n(t[r]||{},o)}}),t};!0===t&&(i=r[1],r=Array.prototype.slice.call(r,2));let a=r.length;for(o=0;o<a;o++)i=n(i,r[o]);return i}Array.prototype.find;let{sma:{prototype:g}}=h().seriesTypes;!function(t){let e=["bottomLine"],o=["top","bottom"],r=["top"];function i(t){return"plot"+t.charAt(0).toUpperCase()+t.slice(1)}function n(t,e){let o=[];return(t.pointArrayMap||[]).forEach(t=>{t!==e&&o.push(i(t))}),o}function a(){let t=this,e=t.pointValKey,o=t.linesApiNames,r=t.areaLinesNames,a=t.points,p=t.options,l=t.graph,h={options:{gapSize:p.gapSize}},c=[],u=n(t,e),f=a.length,y;if(u.forEach((t,e)=>{for(c[e]=[];f--;)y=a[f],c[e].push({x:y.x,plotX:y.plotX,plotY:y[t],isNull:null==y[t]});f=a.length}),t.userOptions.fillColor&&r.length){let e=c[u.indexOf(i(r[0]))],o=1===r.length?a:c[u.indexOf(i(r[1]))],n=t.color;t.points=o,t.nextPoints=e,t.color=t.userOptions.fillColor,t.options=m(a,h),t.graph=t.area,t.fillGraph=!0,g.drawGraph.call(t),t.area=t.graph,delete t.nextPoints,delete t.fillGraph,t.color=n}o.forEach((e,o)=>{c[o]?(t.points=c[o],p[e]?t.options=m(p[e].styles,h):(0,s.error)('Error: "There is no '+e+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),t.graph=t["graph"+e],g.drawGraph.call(t),t["graph"+e]=t.graph):(0,s.error)('Error: "'+e+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),t.points=a,t.options=p,t.graph=l,g.drawGraph.call(t)}function p(t){let e,o=[],r=[];if(t=t||this.points,this.fillGraph&&this.nextPoints){if((e=g.getGraphPath.call(this,this.nextPoints))&&e.length){e[0][0]="L",o=g.getGraphPath.call(this,t),r=e.slice(0,o.length);for(let t=r.length-1;t>=0;t--)o.push(r[t])}}else o=g.getGraphPath.apply(this,arguments);return o}function l(t){let e=[];return(this.pointArrayMap||[]).forEach(o=>{e.push(t[o])}),e}function h(){let t=this.pointArrayMap,e=[],o;e=n(this),g.translate.apply(this,arguments),this.points.forEach(r=>{t.forEach((t,i)=>{o=r[t],this.dataModify&&(o=this.dataModify.modifyValue(o)),null!==o&&(r[e[i]]=this.yAxis.toPixels(o,!0))})})}t.compose=function(t){let i=t.prototype;return i.linesApiNames=i.linesApiNames||e.slice(),i.pointArrayMap=i.pointArrayMap||o.slice(),i.pointValKey=i.pointValKey||"top",i.areaLinesNames=i.areaLinesNames||r.slice(),i.drawGraph=a,i.getGraphPath=p,i.toYData=l,i.translate=h,t}}(o||(o={}));let b=o,{sma:x}=h().seriesTypes;class A extends x{init(){super.init.apply(this,arguments),this.options=m({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(t,e){let o,r,i,n,a,s,p,l,h=e.period,c=e.topBand,u=e.bottomBand,f=t.xData,d=t.yData,m=d?d.length:0,g=[],b=[],x=[];if(!(f.length<h)&&y(d[0])&&4===d[0].length){for(l=h;l<=m;l++)a=f.slice(l-h,l),s=d.slice(l-h,l),n=(p=super.getValues({xData:a,yData:s},e)).xData[0],r=(o=p.yData[0])*(1+c),i=o*(1-u),g.push([n,r,o,i]),b.push(n),x.push([r,o,i]);return{values:g,xData:b,yData:x}}}}A.defaultOptions=m(x.defaultOptions,{marker:{enabled:!1},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/>'},params:{period:20,topBand:.1,bottomBand:.1},bottomLine:{styles:{lineWidth:1,lineColor:void 0}},topLine:{styles:{lineWidth:1}},dataGrouping:{approximation:"averages"}}),function(t,e){let o;for(o in t||(t={}),e)t[o]=e[o]}(A.prototype,{areaLinesNames:["top","bottom"],linesApiNames:["topLine","bottomLine"],nameComponents:["period","topBand","bottomBand"],nameBase:"Price envelopes",pointArrayMap:["top","middle","bottom"],parallelArrays:["x","y","top","bottom"],pointValKey:"middle"}),b.compose(A),h().registerSeriesType("priceenvelopes",A);let v=p();return a.default})());