UNPKG

highcharts

Version:
14 lines 5.1 kB
!/** * Highstock JS v13.0.1 (2026-08-17) * @module highcharts/indicators/acceleration-bands * @requires highcharts * @requires highcharts/modules/stock * * Indicator series type for Highcharts Stock * * (c) 2010-2026 Highsoft AS * Author: Daniel Studencki * * 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/acceleration-bands",["highcharts/highcharts"],function(e){return t(e,e.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/indicators/acceleration-bands"]=t(e._Highcharts,e._Highcharts.SeriesRegistry):e.Highcharts=t(e.Highcharts,e.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(e,t)=>(()=>{"use strict";var a,r={512(e){e.exports=t},944(t){t.exports=e}};let i={};function o(e){let t=i[e];if(void 0!==t)return t.exports;let a=i[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.n=e=>{let t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{if(Array.isArray(t))for(var a=0;a<t.length;){var r=t[a++],i=t[a++];o.o(e,r)?0===i&&a++:0===i?Object.defineProperty(e,r,{enumerable:!0,value:t[a++]}):Object.defineProperty(e,r,{enumerable:!0,get:i})}else for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let s={};o.d(s,{default:()=>y});var n=o(944),l=o.n(n),p=o(512),h=o.n(p);let{sma:{prototype:c}}=h().seriesTypes;!function(e){let t=["bottomLine"],a=["top","bottom"],r=["top"];function i(e){return"plot"+e.charAt(0).toUpperCase()+e.slice(1)}function o(e,t){let a=[];return(e.pointArrayMap||[]).forEach(e=>{e!==t&&a.push(i(e))}),a}function s(){let e=this,t=e.pointValKey,a=e.linesApiNames,r=e.areaLinesNames,s=e.points,l=e.options,p=e.graph,h={options:{gapSize:l.gapSize}},d=[],u=o(e,t),f=s.length,y;if(u.forEach((e,t)=>{for(d[t]=[];f--;)y=s[f],d[t].push({x:y.x,plotX:y.plotX,plotY:y[e],isNull:!(0,n.defined)(y[e])});f=s.length}),e.userOptions.fillColor&&r.length){let t=d[u.indexOf(i(r[0]))],a=1===r.length?s:d[u.indexOf(i(r[1]))],o=e.color;e.points=a,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=o}a.forEach((t,a)=>{d[a]?(e.points=d[a],l[t]?e.options=(0,n.merge)(l[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=l,e.graph=p,c.drawGraph.call(e)}function l(e){let t,a=[],r=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((t=c.getGraphPath.call(this,this.nextPoints))&&t.length){t[0][0]="L",a=c.getGraphPath.call(this,e),r=t.slice(0,a.length);for(let e=r.length-1;e>=0;e--)a.push(r[e])}}else a=c.getGraphPath.apply(this,arguments);return a}function p(e){let t=[];return(this.pointArrayMap||[]).forEach(a=>{t.push(e[a])}),t}function h(){let e=this.pointArrayMap,t=[],a;t=o(this),c.translate.apply(this,arguments),this.points.forEach(r=>{e.forEach((e,i)=>{a=r[e],this.dataModify&&(a=this.dataModify.modifyValue(a)),null!==a&&(r[t[i]]=this.yAxis.toPixels(a,!0))})})}e.compose=function(e){let i=e.prototype;return i.linesApiNames=i.linesApiNames||t.slice(),i.pointArrayMap=i.pointArrayMap||a.slice(),i.pointValKey=i.pointValKey||"top",i.areaLinesNames=i.areaLinesNames||r.slice(),i.drawGraph=s,i.getGraphPath=l,i.toYData=p,i.translate=h,e}}(a||(a={}));let d=a,{sma:u}=h().seriesTypes;class f extends u{getValues(e,t){let a,r,i,o,s,l,p,h,c,d,u,f=t.period,y=t.factor,g=t.index,m=e.xData,x=e.yData,b=x?x.length:0,A=[],D=[],v=[],O=[],P=[];if(!(b<f)){for(u=0;u<=b;u++){if(u<b){var G,M,N,w;G=x[u][2],M=x[u][1],s=(0,n.correctFloat)(M-G)/((0,n.correctFloat)(M+G)/2)*1e3*y,A.push((N=x[u][1],N*(0,n.correctFloat)(1+2*s))),D.push((w=x[u][2],w*(0,n.correctFloat)(1-2*s)))}u>=f&&(c=m.slice(u-f,u),d=x.slice(u-f,u),p=super.getValues.call(this,{xData:c,yData:A.slice(u-f,u)},{period:f}),h=super.getValues.call(this,{xData:c,yData:D.slice(u-f,u)},{period:f}),o=(l=super.getValues.call(this,{xData:c,yData:d},{period:f,index:g})).xData[0],r=p.yData[0],i=h.yData[0],a=l.yData[0],v.push([o,r,a,i]),O.push(o),P.push([r,a,i]))}return{values:v,xData:O,yData:P}}}}f.defaultOptions=(0,n.merge)(u.defaultOptions,{params:{period:20,factor:.001,index:3},lineWidth:1,topLine:{styles:{lineWidth:1}},bottomLine:{styles:{lineWidth:1}},dataGrouping:{approximation:"averages"}}),(0,n.extend)(f.prototype,{areaLinesNames:["top","bottom"],linesApiNames:["topLine","bottomLine"],nameBase:"Acceleration Bands",nameComponents:["period","factor"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),d.compose(f),h().registerSeriesType("abands",f);let y=l();return s.default})());