highcharts
Version:
JavaScript charting framework
14 lines • 5.16 kB
JavaScript
!/**
* Highstock JS v13.0.1 (2026-08-17)
* @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(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(e._Highcharts,e._Highcharts.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/indicators/price-envelopes",["highcharts/highcharts"],function(e){return t(e,e.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/indicators/price-envelopes"]=t(e._Highcharts,e._Highcharts.SeriesRegistry):e.Highcharts=t(e.Highcharts,e.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(e,t)=>(()=>{"use strict";var o,r={512(e){e.exports=t},944(t){t.exports=e}};let i={};function a(e){let t=i[e];if(void 0!==t)return t.exports;let o=i[e]={exports:{}};return r[e](o,o.exports,a),o.exports}a.n=e=>{let t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{if(Array.isArray(t))for(var o=0;o<t.length;){var r=t[o++],i=t[o++];a.o(e,r)?0===i&&o++:0===i?Object.defineProperty(e,r,{enumerable:!0,value:t[o++]}):Object.defineProperty(e,r,{enumerable:!0,get:i})}else for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let s={};a.d(s,{default:()=>y});var n=a(944),p=a.n(n),l=a(512),h=a.n(l);let{sma:{prototype:c}}=h().seriesTypes;!function(e){let t=["bottomLine"],o=["top","bottom"],r=["top"];function i(e){return"plot"+e.charAt(0).toUpperCase()+e.slice(1)}function a(e,t){let o=[];return(e.pointArrayMap||[]).forEach(e=>{e!==t&&o.push(i(e))}),o}function s(){let e=this,t=e.pointValKey,o=e.linesApiNames,r=e.areaLinesNames,s=e.points,p=e.options,l=e.graph,h={options:{gapSize:p.gapSize}},d=[],f=a(e,t),u=s.length,y;if(f.forEach((e,t)=>{for(d[t]=[];u--;)y=s[u],d[t].push({x:y.x,plotX:y.plotX,plotY:y[e],isNull:!(0,n.defined)(y[e])});u=s.length}),e.userOptions.fillColor&&r.length){let t=d[f.indexOf(i(r[0]))],o=1===r.length?s:d[f.indexOf(i(r[1]))],a=e.color;e.points=o,e.nextPoints=t,e.color=e.userOptions.fillColor,e.options=(0,n.merge)(s,h),e.graph=e.area,e.fillGraph=!0,c.drawGraph.call(e),e.area=e.graph,delete e.nextPoints,delete e.fillGraph,e.color=a}o.forEach((t,o)=>{d[o]?(e.points=d[o],p[t]?e.options=(0,n.merge)(p[t].styles,h):(0,n.error)('Error: "There is no '+t+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),e.graph=e["graph"+t],c.drawGraph.call(e),e["graph"+t]=e.graph):(0,n.error)('Error: "'+t+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),e.points=s,e.options=p,e.graph=l,c.drawGraph.call(e)}function p(e){let t,o=[],r=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((t=c.getGraphPath.call(this,this.nextPoints))&&t.length){t[0][0]="L",o=c.getGraphPath.call(this,e),r=t.slice(0,o.length);for(let e=r.length-1;e>=0;e--)o.push(r[e])}}else o=c.getGraphPath.apply(this,arguments);return o}function l(e){let t=[];return(this.pointArrayMap||[]).forEach(o=>{t.push(e[o])}),t}function h(){let e=this.pointArrayMap,t=[],o;t=a(this),c.translate.apply(this,arguments),this.points.forEach(r=>{e.forEach((e,i)=>{o=r[e],this.dataModify&&(o=this.dataModify.modifyValue(o)),null!==o&&(r[t[i]]=this.yAxis.toPixels(o,!0))})})}e.compose=function(e){let i=e.prototype;return i.linesApiNames=i.linesApiNames||t.slice(),i.pointArrayMap=i.pointArrayMap||o.slice(),i.pointValKey=i.pointValKey||"top",i.areaLinesNames=i.areaLinesNames||r.slice(),i.drawGraph=s,i.getGraphPath=p,i.toYData=l,i.translate=h,e}}(o||(o={}));let d=o,{sma:f}=h().seriesTypes;class u extends f{init(){super.init.apply(this,arguments),this.options=(0,n.merge)({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(e,t){let o,r,i,a,s,p,l,h,c=t.period,d=t.topBand,f=t.bottomBand,u=e.xData,y=e.yData,m=y?y.length:0,g=[],b=[],x=[];if(!(u.length<c)&&(0,n.isArray)(y[0])&&4===y[0].length){for(h=c;h<=m;h++)s=u.slice(h-c,h),p=y.slice(h-c,h),a=(l=super.getValues({xData:s,yData:p},t)).xData[0],r=(o=l.yData[0])*(1+d),i=o*(1-f),g.push([a,r,o,i]),b.push(a),x.push([r,o,i]);return{values:g,xData:b,yData:x}}}}u.defaultOptions=(0,n.merge)(f.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"}}),(0,n.extend)(u.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"}),d.compose(u),h().registerSeriesType("priceenvelopes",u);let y=p();return s.default})());