highcharts
Version:
JavaScript charting framework
14 lines • 4.78 kB
JavaScript
!/**
* Highstock JS v13.0.1 (2026-08-17)
* @module highcharts/indicators/price-channel
* @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/price-channel",["highcharts/highcharts"],function(e){return t(e,e.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/indicators/price-channel"]=t(e._Highcharts,e._Highcharts.SeriesRegistry):e.Highcharts=t(e.Highcharts,e.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(e,t)=>(()=>{"use strict";var r,i={512(e){e.exports=t},944(t){t.exports=e}};let o={};function a(e){let t=o[e];if(void 0!==t)return t.exports;let r=o[e]={exports:{}};return i[e](r,r.exports,a),r.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 r=0;r<t.length;){var i=t[r++],o=t[r++];a.o(e,i)?0===o&&r++:0===o?Object.defineProperty(e,i,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,i,{enumerable:!0,get:o})}else for(var i in t)a.o(t,i)&&!a.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let n={};a.d(n,{default:()=>y});var s=a(944),p=a.n(s);let l=function(e,t,r){return e.reduce((e,i)=>[Math.min(e[0],i[t]),Math.max(e[1],i[r])],[Number.MAX_VALUE,-Number.MAX_VALUE])};var h=a(512),c=a.n(h);let{sma:{prototype:u}}=c().seriesTypes;!function(e){let t=["bottomLine"],r=["top","bottom"],i=["top"];function o(e){return"plot"+e.charAt(0).toUpperCase()+e.slice(1)}function a(e,t){let r=[];return(e.pointArrayMap||[]).forEach(e=>{e!==t&&r.push(o(e))}),r}function n(){let e=this,t=e.pointValKey,r=e.linesApiNames,i=e.areaLinesNames,n=e.points,p=e.options,l=e.graph,h={options:{gapSize:p.gapSize}},c=[],f=a(e,t),d=n.length,g;if(f.forEach((e,t)=>{for(c[t]=[];d--;)g=n[d],c[t].push({x:g.x,plotX:g.plotX,plotY:g[e],isNull:!(0,s.defined)(g[e])});d=n.length}),e.userOptions.fillColor&&i.length){let t=c[f.indexOf(o(i[0]))],r=1===i.length?n:c[f.indexOf(o(i[1]))],a=e.color;e.points=r,e.nextPoints=t,e.color=e.userOptions.fillColor,e.options=(0,s.merge)(n,h),e.graph=e.area,e.fillGraph=!0,u.drawGraph.call(e),e.area=e.graph,delete e.nextPoints,delete e.fillGraph,e.color=a}r.forEach((t,r)=>{c[r]?(e.points=c[r],p[t]?e.options=(0,s.merge)(p[t].styles,h):(0,s.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],u.drawGraph.call(e),e["graph"+t]=e.graph):(0,s.error)('Error: "'+t+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),e.points=n,e.options=p,e.graph=l,u.drawGraph.call(e)}function p(e){let t,r=[],i=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((t=u.getGraphPath.call(this,this.nextPoints))&&t.length){t[0][0]="L",r=u.getGraphPath.call(this,e),i=t.slice(0,r.length);for(let e=i.length-1;e>=0;e--)r.push(i[e])}}else r=u.getGraphPath.apply(this,arguments);return r}function l(e){let t=[];return(this.pointArrayMap||[]).forEach(r=>{t.push(e[r])}),t}function h(){let e=this.pointArrayMap,t=[],r;t=a(this),u.translate.apply(this,arguments),this.points.forEach(i=>{e.forEach((e,o)=>{r=i[e],this.dataModify&&(r=this.dataModify.modifyValue(r)),null!==r&&(i[t[o]]=this.yAxis.toPixels(r,!0))})})}e.compose=function(e){let o=e.prototype;return o.linesApiNames=o.linesApiNames||t.slice(),o.pointArrayMap=o.pointArrayMap||r.slice(),o.pointValKey=o.pointValKey||"top",o.areaLinesNames=o.areaLinesNames||i.slice(),o.drawGraph=n,o.getGraphPath=p,o.toYData=l,o.translate=h,e}}(r||(r={}));let f=r,{sma:d}=c().seriesTypes;class g extends d{getValues(e,t){let r,i,o,a,n,s,p=t.period,h=e.xData,c=e.yData,u=c?c.length:0,f=[],d=[],g=[];if(!(u<p)){for(s=p;s<=u;s++)a=h[s-1],r=((i=(n=l(c.slice(s-p,s),2,1))[1])+(o=n[0]))/2,f.push([a,i,r,o]),d.push(a),g.push([i,r,o]);return{values:f,xData:d,yData:g}}}}g.defaultOptions=(0,s.merge)(d.defaultOptions,{params:{index:void 0,period:20},lineWidth:1,topLine:{styles:{lineColor:"var(--highcharts-color-2)",lineWidth:1}},bottomLine:{styles:{lineColor:"var(--highcharts-color-8)",lineWidth:1}},dataGrouping:{approximation:"averages"}}),(0,s.extend)(g.prototype,{areaLinesNames:["top","bottom"],nameBase:"Price Channel",nameComponents:["period"],linesApiNames:["topLine","bottomLine"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),f.compose(g),c().registerSeriesType("pc",g);let y=p();return n.default})());