/* Highcharts JS v7.0.3 (2019-02-06) Indicator series type for Highstock (c) 2010-2019 Pawe Dalek License: www.highcharts.com/license */ (function(q){"object"===typeof module&&module.exports?(q["default"]=q,module.exports=q):"function"===typeof define&&define.amd?define(function(){return q}):q("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(q){(function(n){var q=Math.abs,v=n.noop,w=n.addEvent,y=n.correctFloat,A=n.seriesType,x=n.seriesTypes.column.prototype;A("vbp","sma",{params:{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:{enabled:!0,allowOverlap:!0,verticalAlign:"top",format:"P: {point.volumePos:.2f} | N: {point.volumeNeg:.2f}",padding:0,style:{fontSize:"7px"}}},{nameBase:"Volume by Price",bindTo:{series:!1,eventName:"afterSetExtremes"},calculateOn:"render",markerAttribs:v,drawGraph:v,getColumnMetrics:x.getColumnMetrics, crispCol:x.crispCol,init:function(b){var a,c;n.seriesTypes.sma.prototype.init.apply(this,arguments);a=this.options.params;c=this.linkedParent;a=b.get(a.volumeSeriesID);this.addCustomEvents(c,a);return this},addCustomEvents:function(b,a){function c(){e.chart.redraw();e.setData([]);e.zoneStarts=[];e.zoneLinesSVG&&(e.zoneLinesSVG.destroy(),delete e.zoneLinesSVG)}var e=this;e.dataEventsToUnbind.push(w(b,"remove",function(){c()}));a&&e.dataEventsToUnbind.push(w(a,"remove",function(){c()}));return e},animate:function(b){var a= this,c={};n.svg&&!b&&(c.translateX=a.yAxis.pos,a.group.animate(c,n.extend(n.animObject(a.options.animation),{step:function(b,c){a.group.attr({scaleX:Math.max(.001,c.pos)})}})),a.animate=null)},drawPoints:function(){this.options.volumeDivision.enabled&&(this.posNegVolume(!0,!0),x.drawPoints.apply(this,arguments),this.posNegVolume(!1,!1));x.drawPoints.apply(this,arguments)},posNegVolume:function(b,a){var c=a?["positive","negative"]:["negative","positive"],e=this.options.volumeDivision,l=this.points.length, h=[],d=[],f=0,m,g,t,k;b?(this.posWidths=h,this.negWidths=d):(h=this.posWidths,d=this.negWidths);for(;fa.pointPadding?a.pointPadding:.1,a=b.volumeDataArray,g=n.arrayMax(a),t=c.plotWidth/2,z=c.plotTop,k=q(e.toPixels(l)-e.toPixels(l+b.rangeStep)),u=q(e.toPixels(l)-e.toPixels(l+b.rangeStep)),p&&(l=q(k*(1-2*p)),f=q((k-l)/2),k=q(l)),m.forEach(function(a,c){v=a.barX=a.plotX=0;w=a.plotY=e.toPixels(d[c].start)-z-(e.reversed?k-u: k)-f;r=y(t*d[c].wholeVolumeData/g);a.pointWidth=r;a.shapeArgs=b.crispCol.apply(b,[v,w,r,k]);a.volumeNeg=d[c].negativeVolumeData;a.volumePos=d[c].positiveVolumeData;a.volumeAll=d[c].wholeVolumeData}),h.enabled&&b.drawZones(c,e,b.zoneStarts,h.styles))},getValues:function(b,a){var c=b.processedXData,e=b.processedYData,l=this.chart,h=a.ranges,d=[],f=[],m=[],g;if(!b.chart)return n.error("Base series not found! In case it has been removed, add a new one.",!0,l);if(!(g=l.get(a.volumeSeriesID)))return n.error("Series "+ a.volumeSeriesID+" not found! Check `volumeSeriesID`.",!0,l);if((a=n.isArray(e[0]))&&4!==e[0].length)return n.error("Type of "+b.name+" series is different than line, OHLC or candlestick.",!0,l);(this.priceZones=this.specifyZones(a,c,e,h,g)).forEach(function(a,b){d.push([a.x,a.end]);f.push(d[b][0]);m.push(d[b][1])});return{values:d,xData:f,yData:m}},specifyZones:function(b,a,c,e,l){var h;if(b){h=c.length;for(var d=c[0][3],f=d,m=1,g;mf&&(f=g);h={min:d,max:f}}else h=!1; h=(d=h)?d.min:n.arrayMin(c);g=d?d.max:n.arrayMax(c);var d=this.zoneStarts=[],f=[],t=0,m=1,k;if(!h||!g)return this.points.length&&(this.setData([]),this.zoneStarts=[],this.zoneLinesSVG.destroy()),[];k=this.rangeStep=y(g-h)/e;for(d.push(h);t=a.end&&a.index===m&&(u=!0),(r>a.start||k)&&(rr?a.negativeVolumeData+=f[p]:a.positiveVolumeData+=f[p]);h.volumeDataArray.push(a.wholeVolumeData)});return a},drawZones:function(b,a, c,e){var l=b.renderer,h=this.zoneLinesSVG,d=[],f=b.plotWidth,m=b.plotTop,g;c.forEach(function(c){g=a.toPixels(c)-m;d=d.concat(b.renderer.crispLine(["M",0,g,"L",f,g],e.lineWidth))});h?h.animate({d:d}):h=this.zoneLinesSVG=l.path(d).attr({"stroke-width":e.lineWidth,stroke:e.color,dashstyle:e.dashStyle,zIndex:this.group.zIndex+.1}).add(this.group)}},{destroy:function(){this.negativeGraphic&&(this.negativeGraphic=this.negativeGraphic.destroy());return n.Point.prototype.destroy.apply(this,arguments)}})})(q)}); //# sourceMappingURL=volume-by-price.js.map