/** * Highstock JS v11.2.0 (2023-10-30) * * Indicator series type for Highcharts Stock * * (c) 2010-2021 Paweł Dalek * * License: www.highcharts.com/license */!function(t){"object"==typeof module&&module.exports?(t.default=t,module.exports=t):"function"==typeof define&&define.amd?define("highcharts/indicators/volume-by-price",["highcharts","highcharts/modules/stock"],function(e){return t(e),t.Highcharts=e,t}):t("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(t){"use strict";var e=t?t._modules:{};function o(t,e,o,i){t.hasOwnProperty(e)||(t[e]=i.apply(null,o),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:e,module:t[e]}})))}o(e,"Stock/Indicators/VBP/VBPPoint.js",[e["Core/Series/SeriesRegistry.js"]],function(t){var e,o=this&&this.__extends||(e=function(t,o){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])})(t,o)},function(t,o){if("function"!=typeof o&&null!==o)throw TypeError("Class extends value "+String(o)+" is not a constructor or null");function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)});return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.destroy=function(){this.negativeGraphic&&(this.negativeGraphic=this.negativeGraphic.destroy()),t.prototype.destroy.apply(this,arguments)},e}(t.seriesTypes.sma.prototype.pointClass)}),o(e,"Stock/Indicators/VBP/VBPIndicator.js",[e["Stock/Indicators/VBP/VBPPoint.js"],e["Core/Animation/AnimationUtilities.js"],e["Core/Globals.js"],e["Core/Series/SeriesRegistry.js"],e["Core/Utilities.js"],e["Core/Chart/StockChart.js"]],function(t,e,o,i,n,s){var r,a=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}),p=e.animObject,l=o.noop,u=i.seriesTypes,h=u.column.prototype,d=u.sma,c=n.addEvent,f=n.arrayMax,v=n.arrayMin,m=n.correctFloat,y=n.defined,g=n.error,x=n.extend,S=n.isArray,V=n.merge,D=Math.abs,P=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.data=void 0,e.negWidths=void 0,e.options=void 0,e.points=void 0,e.posWidths=void 0,e.priceZones=void 0,e.rangeStep=void 0,e.volumeDataArray=void 0,e.zoneStarts=void 0,e.zoneLinesSVG=void 0,e}return a(e,t),e.prototype.init=function(e,o){var i=this;delete o.data,t.prototype.init.apply(i,arguments);var n=c(s,"afterLinkSeries",function(){if(i.options){var t=i.options.params,o=i.linkedParent,s=e.get(t.volumeSeriesID);i.addCustomEvents(o,s)}n()},{order:1});return i},e.prototype.addCustomEvents=function(t,e){var o=this,i=function(){o.chart.redraw(),o.setData([]),o.zoneStarts=[],o.zoneLinesSVG&&(o.zoneLinesSVG=o.zoneLinesSVG.destroy())};return o.dataEventsToUnbind.push(c(t,"remove",function(){i()})),e&&o.dataEventsToUnbind.push(c(e,"remove",function(){i()})),o},e.prototype.animate=function(t){var e=this,o=e.chart.inverted,i=e.group,n={};if(!t&&i){var s=o?e.yAxis.top:e.xAxis.left;o?(i["forceAnimate:translateY"]=!0,n.translateY=s):(i["forceAnimate:translateX"]=!0,n.translateX=s),i.animate(n,x(p(e.options.animation),{step:function(t,o){e.group.attr({scaleX:Math.max(.001,o.pos)})}}))}},e.prototype.drawPoints=function(){this.options.volumeDivision.enabled&&(this.posNegVolume(!0,!0),h.drawPoints.apply(this,arguments),this.posNegVolume(!1,!1)),h.drawPoints.apply(this,arguments)},e.prototype.posNegVolume=function(t,e){var o,i,n,s,r=e?["positive","negative"]:["negative","positive"],a=this.options.volumeDivision,p=this.points.length,l=[],u=[],h=0;for(t?(this.posWidths=l,this.negWidths=u):(l=this.posWidths,u=this.negWidths);hn&&(n=e);return{min:i,max:n}}(o),r=this.zoneStarts=[],a=[],p=s?s.min:v(o),l=s?s.max:f(o),u=0,h=1,d=this.linkedParent;if(!this.options.compareToMain&&d.dataModify&&(p=d.dataModify.modifyValue(p),l=d.dataModify.modifyValue(l)),!y(p)||!y(l))return this.points.length&&(this.setData([]),this.zoneStarts=[],this.zoneLinesSVG&&(this.zoneLinesSVG=this.zoneLinesSVG.destroy())),[];var c=this.rangeStep=m(l-p)/i;for(r.push(p);u=e.end&&e.index===c&&(a=!0),(p>e.start||r)&&(pp?e.negativeVolumeData+=d[l]:e.positiveVolumeData+=d[l])}u.volumeDataArray.push(e.wholeVolumeData)}),e},e.prototype.drawZones=function(t,e,o,i){var n,s=t.renderer,r=t.plotWidth,a=t.plotTop,p=this.zoneLinesSVG,l=[];o.forEach(function(o){n=e.toPixels(o)-a,l=l.concat(t.renderer.crispLine([["M",0,n],["L",r,n]],i.lineWidth))}),p?p.animate({d:l}):p=this.zoneLinesSVG=s.path(l).attr({"stroke-width":i.lineWidth,stroke:i.color,dashstyle:i.dashStyle,zIndex:this.group.zIndex+.1}).add(this.group)},e.defaultOptions=V(d.defaultOptions,{params:{index:void 0,period:void 0,ranges:12,volumeSeriesID:"volume"},zoneLines:{enabled:!0,styles:{color:"#0A9AC9",dashStyle:"LongDash",lineWidth:1}},volumeDivision:{enabled:!0,styles:{positiveColor:"rgba(144, 237, 125, 0.8)",negativeColor:"rgba(244, 91, 91, 0.8)"}},animationLimit:1e3,enableMouseTracking:!1,pointPadding:0,zIndex:-1,crisp:!0,dataGrouping:{enabled:!1},dataLabels:{allowOverlap:!0,enabled:!0,format:"P: {point.volumePos:.2f} | N: {point.volumeNeg:.2f}",padding:0,style:{fontSize:"0.5em"},verticalAlign:"top"}}),e}(d);return x(P.prototype,{nameBase:"Volume by Price",nameComponents:["ranges"],calculateOn:{chart:"render",xAxis:"afterSetExtremes"},pointClass:t,markerAttribs:l,drawGraph:l,getColumnMetrics:h.getColumnMetrics,crispCol:h.crispCol}),i.registerSeriesType("vbp",P),P}),o(e,"masters/indicators/volume-by-price.src.js",[],function(){})});//# sourceMappingURL=volume-by-price.js.map