Icard/angular-clarity-master(work.../node_modules/highcharts/indicators/volume-by-price.js

9 lines
7.3 KiB
JavaScript
Raw Normal View History

2024-07-16 14:55:36 +00:00
!/**
* Highstock JS v11.4.1 (2024-04-04)
*
* Indicator series type for Highcharts Stock
*
* (c) 2010-2024 Paweł Dalek
*
* License: www.highcharts.com/license
*/function(e){"object"==typeof module&&module.exports?(e.default=e,module.exports=e):"function"==typeof define&&define.amd?define("highcharts/indicators/volume-by-price",["highcharts","highcharts/modules/stock"],function(t){return e(t),e.Highcharts=t,e}):e("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(e){"use strict";var t=e?e._modules:{};function s(e,t,s,i){e.hasOwnProperty(t)||(e[t]=i.apply(null,s),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:t,module:e[t]}})))}s(t,"Stock/Indicators/VBP/VBPPoint.js",[t["Core/Series/SeriesRegistry.js"]],function(e){let{sma:{prototype:{pointClass:t}}}=e.seriesTypes;return class extends t{destroy(){this.negativeGraphic&&(this.negativeGraphic=this.negativeGraphic.destroy()),super.destroy.apply(this,arguments)}}}),s(t,"Stock/Indicators/VBP/VBPIndicator.js",[t["Stock/Indicators/VBP/VBPPoint.js"],t["Core/Animation/AnimationUtilities.js"],t["Core/Globals.js"],t["Core/Series/SeriesRegistry.js"],t["Core/Utilities.js"]],function(e,t,s,i,o){let{animObject:a}=t,{noop:n}=s,{column:{prototype:r},sma:l}=i.seriesTypes,{addEvent:p,arrayMax:h,arrayMin:d,correctFloat:u,defined:c,error:m,extend:g,isArray:f,merge:v}=o,y=Math.abs;class V extends l{init(e,t){let s=this;delete t.data,super.init.apply(s,arguments);let i=p(this.chart.constructor,"afterLinkSeries",function(){if(s.options){let t=s.options.params,i=s.linkedParent,o=e.get(t.volumeSeriesID);s.addCustomEvents(i,o)}i()},{order:1});return s}addCustomEvents(e,t){let s=this,i=()=>{s.chart.redraw(),s.setData([]),s.zoneStarts=[],s.zoneLinesSVG&&(s.zoneLinesSVG=s.zoneLinesSVG.destroy())};return s.dataEventsToUnbind.push(p(e,"remove",function(){i()})),t&&s.dataEventsToUnbind.push(p(t,"remove",function(){i()})),s}animate(e){let t=this,s=t.chart.inverted,i=t.group,o={};if(!e&&i){let e=s?t.yAxis.top:t.xAxis.left;s?(i["forceAnimate:translateY"]=!0,o.translateY=e):(i["forceAnimate:translateX"]=!0,o.translateX=e),i.animate(o,g(a(t.options.animation),{step:function(e,s){t.group.attr({scaleX:Math.max(.001,s.pos)})}}))}}drawPoints(){this.options.volumeDivision.enabled&&(this.posNegVolume(!0,!0),r.drawPoints.apply(this,arguments),this.posNegVolume(!1,!1)),r.drawPoints.apply(this,arguments)}posNegVolume(e,t){let s=t?["positive","negative"]:["negative","positive"],i=this.options.volumeDivision,o=this.points.length,a=[],n=[],r=0,l,p,h,d;for(e?(this.posWidths=a,this.negWidths=n):(a=this.posWidths,n=this.negWidths);r<o;r++)(d=this.points[r])[s[0]+"Graphic"]=d.graphic,d.graphic=d[s[1]+"Graphic"],e&&(l=d.shapeArgs.width,(h=(p=this.priceZones[r]).wholeVolumeData)?(a.push(l/h*p.positiveVolumeData),n.push(l/h*p.negativeVolumeData)):(a.push(0),n.push(0))),d.color=t?i.styles.positiveColor:i.styles.negativeColor,d.shapeArgs.width=t?this.posWidths[r]:this.negWidths[r],d.shapeArgs.x=t?d.shapeArgs.x:this.posWidths[r]}translate(){let e=this,t=e.options,s=e.chart,i=e.yAxis,o=i.min,a=e.options.zoneLines,n=e.priceZones,l=0,p,d,c,m,g,f,v,V,x,D;r.translate.apply(e);let S=e.points;S.length&&(v=t.pointPadding<.5?t.pointPadding:.1,p=h(e.volumeDataArray),d=s.plotWidth/2,V=s.plotTop,c=y(i.toPixels(o)-i.toPixels(o+e.rangeStep)),g=y(i.toPixels(o)-i.toPixels(o+e.rangeStep)),v&&(m=y(c*(1-2*v)),l=y((c-m)/2),c=y(m)),S.forEach(function(t,s){x=t.barX=t.plotX=0,D=t.plotY=i.toPixels(n[s].start)-V-(i.reversed?c-g:c)-l,f=u(d*n[s].wholeVolumeData/p),t.pointWidth=f,t.shapeArgs=e.crispCol.apply(e,[x,D,f,c]),t.volumeNeg=n[s].negativeVolumeData,t.volumePos=n[s].positiveVolumeData,t.volumeAll=n[s].wholeVolumeData}),a.enabled&&e.drawZones(s,i,e.zoneStarts,a.styles))}getExtremes(){let e;let t=this.options.compare,s=this.options.cumulative;return this.options.compare?(this.options.compare=void 0,e=super.getExtremes(),this.options.compare=t):this.options.cumulative?(this.options.cumulative=!1,e=super.getExtremes(),this.options.cumulative=s):e=super.getExtremes(),e}getValues(e,t){let s=e.processedXData,i=e.processedYData,o=this.chart,a=t.ranges,n=[],r=[],l=[],p=o.get(t.volumeSeriesID);if(!e.chart){m("Base series not found! In case it has be