highcharts
Version:
JavaScript charting framework
14 lines • 4.36 kB
JavaScript
!/**
* Highstock JS v13.0.1 (2026-08-17)
* @module highcharts/indicators/pivot-points
* @requires highcharts
* @requires highcharts/modules/stock
*
* Indicator series type for Highcharts Stock
*
* (c) 2010-2026 Highsoft AS
* Author: Paweł Fus
*
* 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/pivot-points",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/indicators/pivot-points"]=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={512(t){t.exports=e},944(e){e.exports=t}};let r={};function o(t){let e=r[t];if(void 0!==e)return e.exports;let l=r[t]={exports:{}};return a[t](l,l.exports,o),l.exports}o.n=t=>{let e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{if(Array.isArray(e))for(var a=0;a<e.length;){var r=e[a++],l=e[a++];o.o(t,r)?0===l&&a++:0===l?Object.defineProperty(t,r,{enumerable:!0,value:e[a++]}):Object.defineProperty(t,r,{enumerable:!0,get:l})}else for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let l={};o.d(l,{default:()=>f});var n=o(944),s=o.n(n),i=o(512),p=o.n(i);let d=p().seriesTypes.sma.prototype.pointClass;function h(t,e){let a=t.series.pointArrayMap,r,o=a.length;for(p().seriesTypes.sma.prototype.pointClass.prototype[e].call(t);o--;)t[r="dataLabel"+a[o]]&&t[r].element&&t[r].destroy(),t[r]=null}let{sma:c}=p().seriesTypes;class u extends c{toYData(t){return[t.P]}translate(){let t=this;super.translate.apply(t),t.points.forEach(function(e){t.pointArrayMap.forEach(function(a){(0,n.defined)(e[a])&&(e["plot"+a]=t.yAxis.toPixels(e[a],!0))})}),t.plotEndPoint=t.xAxis.toPixels(t.endPoint,!0)}getGraphPath(t){let e=this,a=[[],[],[],[],[],[],[],[],[]],r=e.pointArrayMap.length,o=e.plotEndPoint,l=[],s,i,p=t.length,d;for(;p--;){for(d=0,i=t[p];d<r;d++)s=e.pointArrayMap[d],(0,n.defined)(i[s])&&a[d].push({plotX:i.plotX,plotY:i["plot"+s],isNull:!1},{plotX:o,plotY:i["plot"+s],isNull:!1},{plotX:o,plotY:null,isNull:!0});o=i.plotX}return a.forEach(t=>{l=l.concat(super.getGraphPath.call(e,t))}),l}drawDataLabels(){let t,e,a,r,o=this,l=o.pointArrayMap;o.options.dataLabels.enabled&&(e=o.points.length,l.concat([!1]).forEach((n,s)=>{for(r=e;r--;)a=o.points[r],n?(a.y=a[n],a.pivotLine=n,a.plotY=a["plot"+n],t=a["dataLabel"+n],s&&(a["dataLabel"+l[s-1]]=a.dataLabel),a.dataLabels||(a.dataLabels=[]),a.dataLabels[0]=a.dataLabel=t=t&&t.element?t:null):a["dataLabel"+l[s-1]]=a.dataLabel;super.drawDataLabels.call(o)}))}getValues(t,e){let a,r,o,l,s,i,p,d=e.period,h=t.xData,c=t.yData,u=c?c.length:0,f=this[e.algorithm+"Placement"],y=[],g=[],b=[];if(!(h.length<d)&&(0,n.isArray)(c[0])&&4===c[0].length){for(p=d+1;p<=u+d;p+=d)o=h.slice(p-d-1,p),l=c.slice(p-d-1,p),r=o.length,a=o[r-1],i=f(this.getPivotAndHLC(l)),s=y.push([a].concat(i)),g.push(a),b.push(y[s-1].slice(1));return this.endPoint=o[0]+(a-o[0])/r*d,{values:y,xData:g,yData:b}}}getPivotAndHLC(t){let e=t[t.length-1][3],a=-1/0,r=1/0;return t.forEach(function(t){a=Math.max(a,t[1]),r=Math.min(r,t[2])}),[(a+r+e)/3,a,r,e]}standardPlacement(t){let e=t[1]-t[2];return[null,null,t[0]+e,2*t[0]-t[2],t[0],2*t[0]-t[1],t[0]-e,null,null]}camarillaPlacement(t){let e=t[1]-t[2];return[t[3]+1.5*e,t[3]+1.25*e,t[3]+1.1666*e,t[3]+1.0833*e,t[0],t[3]-1.0833*e,t[3]-1.1666*e,t[3]-1.25*e,t[3]-1.5*e]}fibonacciPlacement(t){let e=t[1]-t[2];return[null,t[0]+e,t[0]+.618*e,t[0]+.382*e,t[0],t[0]-.382*e,t[0]-.618*e,t[0]-e,null]}}u.defaultOptions=(0,n.merge)(c.defaultOptions,{params:{index:void 0,period:28,algorithm:"standard"},marker:{enabled:!1},enableMouseTracking:!1,dataLabels:{enabled:!0,format:"{point.pivotLine}"},dataGrouping:{approximation:"averages"}}),(0,n.extend)(u.prototype,{nameBase:"Pivot Points",pointArrayMap:["R4","R3","R2","R1","P","S1","S2","S3","S4"],pointValKey:"P",pointClass:class extends d{destroyElements(){h(this,"destroyElements")}destroy(){h(this,"destroyElements")}}}),p().registerSeriesType("pivotpoints",u);let f=s();return l.default})());