highcharts
Version:
JavaScript charting framework
20 lines (17 loc) • 5.21 kB
JavaScript
/*
Highstock JS v10.0.0 (2022-03-07)
Indicator series type for Highcharts Stock
(c) 2010-2021 Daniel Studencki
License: www.highcharts.com/license
*/
(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/indicators/price-channel",["highcharts","highcharts/modules/stock"],function(m){a(m);a.Highcharts=m;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function m(a,c,k,g){a.hasOwnProperty(c)||(a[c]=g.apply(null,k),"function"===typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:c,module:a[c]}})))}
a=a?a._modules:{};m(a,"Stock/Indicators/ArrayUtilities.js",[],function(){return{getArrayExtremes:function(a,c,k){return a.reduce(function(a,n){return[Math.min(a[0],n[c]),Math.max(a[1],n[k])]},[Number.MAX_VALUE,-Number.MAX_VALUE])}}});m(a,"Stock/Indicators/MultipleLinesComposition.js",[a["Core/Series/SeriesRegistry.js"],a["Core/Utilities.js"]],function(a,c){var k=a.seriesTypes.sma,m=c.defined,n=c.error,w=c.merge,d;(function(c){function d(b){var a,h=[];b=b||this.points;if(this.fillGraph&&this.nextPoints){if((a=
k.prototype.getGraphPath.call(this,this.nextPoints))&&a.length){a[0][0]="L";h=k.prototype.getGraphPath.call(this,b);a=a.slice(0,h.length);for(var e=a.length-1;0<=e;e--)h.push(a[e])}}else h=k.prototype.getGraphPath.apply(this,arguments);return h}function p(){var b=this,l=b.linesApiNames,h=b.areaLinesNames,e=b.points,c=b.options,v=b.graph,u={options:{gapSize:c.gapSize}},p=[],q=b.getTranslatedLinesNames(b.pointValKey),r=e.length,d;q.forEach(function(b,a){for(p[a]=[];r--;)d=e[r],p[a].push({x:d.x,plotX:d.plotX,
plotY:d[b],isNull:!m(d[b])});r=e.length});if(this.userOptions.fillColor&&h.length){var g=q.indexOf(f(h[0]));g=p[g];h=1===h.length?e:p[q.indexOf(f(h[1]))];q=b.color;b.points=h;b.nextPoints=g;b.color=this.userOptions.fillColor;b.options=w(e,u);b.graph=b.area;b.fillGraph=!0;a.seriesTypes.sma.prototype.drawGraph.call(b);b.area=b.graph;delete b.nextPoints;delete b.fillGraph;b.color=q}l.forEach(function(a,l){p[l]?(b.points=p[l],c[a]?b.options=w(c[a].styles,u):n('Error: "There is no '+a+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names." at mixin/multiple-line.js:34'),
b.graph=b["graph"+a],k.prototype.drawGraph.call(b),b["graph"+a]=b.graph):n('Error: "'+a+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")});b.points=e;b.options=c;b.graph=v;k.prototype.drawGraph.call(b)}function u(b){var a=[];(this.pointArrayMap||[]).forEach(function(l){l!==b&&a.push(f(l))});return a}function f(b){return"plot"+b.charAt(0).toUpperCase()+b.slice(1)}function v(b){var a=[];(this.pointArrayMap||[]).forEach(function(l){a.push(b[l])});
return a}function q(){var b=this,a=b.pointArrayMap,f=[],e;f=b.getTranslatedLinesNames();k.prototype.translate.apply(b,arguments);b.points.forEach(function(l){a.forEach(function(a,c){e=l[a];b.dataModify&&(e=b.dataModify.modifyValue(e));null!==e&&(l[f[c]]=b.yAxis.toPixels(e,!0))})})}var r=[],g=["bottomLine"],y=["top","bottom"],z=["top"];c.compose=function(b){if(-1===r.indexOf(b)){r.push(b);var a=b.prototype;a.linesApiNames=a.linesApiNames||g.slice();a.pointArrayMap=a.pointArrayMap||y.slice();a.pointValKey=
a.pointValKey||"top";a.areaLinesNames=a.areaLinesNames||z.slice();a.drawGraph=p;a.getGraphPath=d;a.toYData=v;a.translate=q;a.getTranslatedLinesNames=u}return b}})(d||(d={}));return d});m(a,"Stock/Indicators/PC/PCIndicator.js",[a["Stock/Indicators/ArrayUtilities.js"],a["Stock/Indicators/MultipleLinesComposition.js"],a["Core/Color/Palettes.js"],a["Core/Series/SeriesRegistry.js"],a["Core/Utilities.js"]],function(a,c,k,g,n){var m=this&&this.__extends||function(){var a=function(c,f){a=Object.setPrototypeOf||
{__proto__:[]}instanceof Array&&function(a,f){a.__proto__=f}||function(a,f){for(var c in f)f.hasOwnProperty(c)&&(a[c]=f[c])};return a(c,f)};return function(c,f){function d(){this.constructor=c}a(c,f);c.prototype=null===f?Object.create(f):(d.prototype=f.prototype,new d)}}(),d=g.seriesTypes.sma,x=n.merge;n=n.extend;var t=function(c){function g(){var a=null!==c&&c.apply(this,arguments)||this;a.data=void 0;a.options=void 0;a.points=void 0;return a}m(g,c);g.prototype.getValues=function(c,d){d=d.period;
var f=c.xData,g=(c=c.yData)?c.length:0,k=[],m=[],n=[],b;if(!(g<d)){for(b=d;b<=g;b++){var l=f[b-1];var h=c.slice(b-d,b);var e=a.getArrayExtremes(h,2,1);h=e[1];var p=e[0];e=(h+p)/2;k.push([l,h,e,p]);m.push(l);n.push([h,e,p])}return{values:k,xData:m,yData:n}}};g.defaultOptions=x(d.defaultOptions,{params:{index:void 0,period:20},lineWidth:1,topLine:{styles:{lineColor:k.colors[2],lineWidth:1}},bottomLine:{styles:{lineColor:k.colors[8],lineWidth:1}},dataGrouping:{approximation:"averages"}});return g}(d);
n(t.prototype,{areaLinesNames:["top","bottom"],nameBase:"Price Channel",nameComponents:["period"],linesApiNames:["topLine","bottomLine"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"});c.compose(t);g.registerSeriesType("pc",t);"";return t});m(a,"masters/indicators/price-channel.src.js",[],function(){})});
//# sourceMappingURL=price-channel.js.map