highcharts
Version:
JavaScript charting framework
14 lines • 4.81 kB
JavaScript
!/**
* Highstock JS v12.5.0 (2026-01-12)
* @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(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(t._Highcharts,t._Highcharts.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/indicators/acceleration-bands",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/indicators/acceleration-bands"]=e(t._Highcharts,t._Highcharts.SeriesRegistry):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(t,e)=>(()=>{"use strict";var a,i={512:t=>{t.exports=e},944:e=>{e.exports=t}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var a=r[t]={exports:{}};return i[t](a,a.exports,o),a.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var a in e)o.o(e,a)&&!o.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var s={};o.d(s,{default:()=>b});var n=o(944),p=o.n(n),l=o(512),h=o.n(l);let{sma:{prototype:c}}=h().seriesTypes,{defined:d,error:u,merge:f}=p();!function(t){let e=["bottomLine"],a=["top","bottom"],i=["top"];function r(t){return"plot"+t.charAt(0).toUpperCase()+t.slice(1)}function o(t,e){let a=[];return(t.pointArrayMap||[]).forEach(t=>{t!==e&&a.push(r(t))}),a}function s(){let t=this,e=t.pointValKey,a=t.linesApiNames,i=t.areaLinesNames,s=t.points,n=t.options,p=t.graph,l={options:{gapSize:n.gapSize}},h=[],y=o(t,e),g=s.length,m;if(y.forEach((t,e)=>{for(h[e]=[];g--;)m=s[g],h[e].push({x:m.x,plotX:m.plotX,plotY:m[t],isNull:!d(m[t])});g=s.length}),t.userOptions.fillColor&&i.length){let e=h[y.indexOf(r(i[0]))],a=1===i.length?s:h[y.indexOf(r(i[1]))],o=t.color;t.points=a,t.nextPoints=e,t.color=t.userOptions.fillColor,t.options=f(s,l),t.graph=t.area,t.fillGraph=!0,c.drawGraph.call(t),t.area=t.graph,delete t.nextPoints,delete t.fillGraph,t.color=o}a.forEach((e,a)=>{h[a]?(t.points=h[a],n[e]?t.options=f(n[e].styles,l):u('Error: "There is no '+e+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),t.graph=t["graph"+e],c.drawGraph.call(t),t["graph"+e]=t.graph):u('Error: "'+e+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),t.points=s,t.options=n,t.graph=p,c.drawGraph.call(t)}function n(t){let e,a=[],i=[];if(t=t||this.points,this.fillGraph&&this.nextPoints){if((e=c.getGraphPath.call(this,this.nextPoints))&&e.length){e[0][0]="L",a=c.getGraphPath.call(this,t),i=e.slice(0,a.length);for(let t=i.length-1;t>=0;t--)a.push(i[t])}}else a=c.getGraphPath.apply(this,arguments);return a}function p(t){let e=[];return(this.pointArrayMap||[]).forEach(a=>{e.push(t[a])}),e}function l(){let t=this.pointArrayMap,e=[],a;e=o(this),c.translate.apply(this,arguments),this.points.forEach(i=>{t.forEach((t,r)=>{a=i[t],this.dataModify&&(a=this.dataModify.modifyValue(a)),null!==a&&(i[e[r]]=this.yAxis.toPixels(a,!0))})})}t.compose=function(t){let r=t.prototype;return r.linesApiNames=r.linesApiNames||e.slice(),r.pointArrayMap=r.pointArrayMap||a.slice(),r.pointValKey=r.pointValKey||"top",r.areaLinesNames=r.areaLinesNames||i.slice(),r.drawGraph=s,r.getGraphPath=n,r.toYData=p,r.translate=l,t}}(a||(a={}));let y=a,{sma:g}=h().seriesTypes,{correctFloat:m,extend:x,merge:A}=p();class D extends g{getValues(t,e){let a,i,r,o,s,n,p,l,h,c,d,u=e.period,f=e.factor,y=e.index,g=t.xData,x=t.yData,A=x?x.length:0,D=[],b=[],v=[],G=[],M=[];if(!(A<u)){for(d=0;d<=A;d++){if(d<A){var N,O;N=x[d][2],O=x[d][1],s=m(O-N)/(m(O+N)/2)*1e3*f,D.push(x[d][1]*m(1+2*s)),b.push(x[d][2]*m(1-2*s))}d>=u&&(h=g.slice(d-u,d),c=x.slice(d-u,d),p=super.getValues.call(this,{xData:h,yData:D.slice(d-u,d)},{period:u}),l=super.getValues.call(this,{xData:h,yData:b.slice(d-u,d)},{period:u}),o=(n=super.getValues.call(this,{xData:h,yData:c},{period:u,index:y})).xData[0],i=p.yData[0],r=l.yData[0],a=n.yData[0],v.push([o,i,a,r]),G.push(o),M.push([i,a,r]))}return{values:v,xData:G,yData:M}}}}D.defaultOptions=A(g.defaultOptions,{params:{period:20,factor:.001,index:3},lineWidth:1,topLine:{styles:{lineWidth:1}},bottomLine:{styles:{lineWidth:1}},dataGrouping:{approximation:"averages"}}),x(D.prototype,{areaLinesNames:["top","bottom"],linesApiNames:["topLine","bottomLine"],nameBase:"Acceleration Bands",nameComponents:["period","factor"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),y.compose(D),h().registerSeriesType("abands",D);let b=p();return s.default})());