highcharts
Version:
JavaScript charting framework
12 lines • 3.95 kB
JavaScript
/**
* Highstock JS v12.3.0 (2025-06-21)
* @module highcharts/indicators/aroon
* @requires highcharts
* @requires highcharts/modules/stock
*
* Indicator series type for Highcharts Stock
*
* (c) 2010-2025 Wojciech Chmiel
*
* License: www.highcharts.com/license
*/import*as e from"../highcharts.js";import"../modules/stock.js";var t,o={};o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var a in t)o.o(t,a)&&!o.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let a=e.default;var r=o.n(a);o.d({},{});let n=e.default.SeriesRegistry;var i=o.n(n);let{sma:{prototype:s}}=i().seriesTypes,{defined:p,error:l,merge:h}=r();!function(e){let t=["bottomLine"],o=["top","bottom"],a=["top"];function r(e){return"plot"+e.charAt(0).toUpperCase()+e.slice(1)}function n(e,t){let o=[];return(e.pointArrayMap||[]).forEach(e=>{e!==t&&o.push(r(e))}),o}function i(){let e=this,t=e.pointValKey,o=e.linesApiNames,a=e.areaLinesNames,i=e.points,c=e.options,u=e.graph,f={options:{gapSize:c.gapSize}},m=[],y=n(e,t),d=i.length,g;if(y.forEach((e,t)=>{for(m[t]=[];d--;)g=i[d],m[t].push({x:g.x,plotX:g.plotX,plotY:g[e],isNull:!p(g[e])});d=i.length}),e.userOptions.fillColor&&a.length){let t=m[y.indexOf(r(a[0]))],o=1===a.length?i:m[y.indexOf(r(a[1]))],n=e.color;e.points=o,e.nextPoints=t,e.color=e.userOptions.fillColor,e.options=h(i,f),e.graph=e.area,e.fillGraph=!0,s.drawGraph.call(e),e.area=e.graph,delete e.nextPoints,delete e.fillGraph,e.color=n}o.forEach((t,o)=>{m[o]?(e.points=m[o],c[t]?e.options=h(c[t].styles,f):l('Error: "There is no '+t+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),e.graph=e["graph"+t],s.drawGraph.call(e),e["graph"+t]=e.graph):l('Error: "'+t+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),e.points=i,e.options=c,e.graph=u,s.drawGraph.call(e)}function c(e){let t,o=[],a=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((t=s.getGraphPath.call(this,this.nextPoints))&&t.length){t[0][0]="L",o=s.getGraphPath.call(this,e),a=t.slice(0,o.length);for(let e=a.length-1;e>=0;e--)o.push(a[e])}}else o=s.getGraphPath.apply(this,arguments);return o}function u(e){let t=[];return(this.pointArrayMap||[]).forEach(o=>{t.push(e[o])}),t}function f(){let e=this.pointArrayMap,t=[],o;t=n(this),s.translate.apply(this,arguments),this.points.forEach(a=>{e.forEach((e,r)=>{o=a[e],this.dataModify&&(o=this.dataModify.modifyValue(o)),null!==o&&(a[t[r]]=this.yAxis.toPixels(o,!0))})})}e.compose=function(e){let r=e.prototype;return r.linesApiNames=r.linesApiNames||t.slice(),r.pointArrayMap=r.pointArrayMap||o.slice(),r.pointValKey=r.pointValKey||"top",r.areaLinesNames=r.areaLinesNames||a.slice(),r.drawGraph=i,r.getGraphPath=c,r.toYData=u,r.translate=f,e}}(t||(t={}));let c=t,{sma:u}=i().seriesTypes,{extend:f,merge:m,pick:y}=r();function d(e,t){let o=e[0],a=0,r;for(r=1;r<e.length;r++)("max"===t&&e[r]>=o||"min"===t&&e[r]<=o)&&(o=e[r],a=r);return a}class g extends u{getValues(e,t){let o,a,r,n,i,s=t.period,p=e.xData,l=e.yData,h=l?l.length:0,c=[],u=[],f=[];for(n=s-1;n<h;n++)r=d((i=l.slice(n-s+1,n+2)).map(function(e){return y(e[2],e)}),"min"),o=d(i.map(function(e){return y(e[1],e)}),"max")/s*100,a=r/s*100,p[n+1]&&(c.push([p[n+1],o,a]),u.push(p[n+1]),f.push([o,a]));return{values:c,xData:u,yData:f}}}g.defaultOptions=m(u.defaultOptions,{params:{index:void 0,period:25},marker:{enabled:!1},tooltip:{pointFormat:'<span style="color:{point.color}">●</span><b> {series.name}</b><br/>Aroon Up: {point.y}<br/>Aroon Down: {point.aroonDown}<br/>'},aroonDown:{styles:{lineWidth:1,lineColor:void 0}},dataGrouping:{approximation:"averages"}}),f(g.prototype,{areaLinesNames:[],linesApiNames:["aroonDown"],nameBase:"Aroon",pointArrayMap:["y","aroonDown"],pointValKey:"y"}),c.compose(g),i().registerSeriesType("aroon",g);let A=r();export{A as default};