/*
 Highcharts JS v9.1.1 (2021-06-03)

 Wind barb series module

 (c) 2010-2021 Torstein Honsi

 License: www.highcharts.com/license
*/
'use strict';(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/modules/windbarb",["highcharts"],function(g){a(g);a.Highcharts=g;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function g(a,d,k,p){a.hasOwnProperty(d)||(a[d]=p.apply(null,k))}a=a?a._modules:{};g(a,"Mixins/OnSeries.js",[a["Series/Column/ColumnSeries.js"],a["Core/Series/Series.js"],a["Core/Utilities.js"]],function(a,
d,k){var p=a.prototype,c=d.prototype,t=k.defined,w=k.stableSort;return{getPlotBox:function(){return c.getPlotBox.call(this.options.onSeries&&this.chart.get(this.options.onSeries)||this)},translate:function(){p.translate.apply(this);var a=this,c=a.options,h=a.chart,d=a.points,k=d.length-1,g,l=c.onSeries;l=l&&h.get(l);c=c.onKey||"y";var B=l&&l.options.step,b=l&&l.points,e=b&&b.length,n=h.inverted,f=a.xAxis,C=a.yAxis,u=0,q;if(l&&l.visible&&e){u=(l.pointXOffset||0)+(l.barW||0)/2;h=l.currentDataGrouping;
var r=b[e-1].x+(h?h.totalRange:0);w(d,function(n,b){return n.x-b.x});for(c="plot"+c[0].toUpperCase()+c.substr(1);e--&&d[k];){var m=b[e];h=d[k];h.y=m.y;if(m.x<=h.x&&"undefined"!==typeof m[c]){if(h.x<=r&&(h.plotY=m[c],m.x<h.x&&!B&&(q=b[e+1])&&"undefined"!==typeof q[c])){var v=(h.x-m.x)/(q.x-m.x);h.plotY+=v*(q[c]-m[c]);h.y+=v*(q.y-m.y)}k--;e++;if(0>k)break}}}d.forEach(function(b,e){b.plotX+=u;if("undefined"===typeof b.plotY||n)0<=b.plotX&&b.plotX<=f.len?n?(b.plotY=f.translate(b.x,0,1,0,1),b.plotX=t(b.y)?
C.translate(b.y,0,0,0,1):0):b.plotY=(f.opposite?0:a.yAxis.len)+f.offset:b.shapeArgs={};if((g=d[e-1])&&g.plotX===b.plotX){"undefined"===typeof g.stackIndex&&(g.stackIndex=0);var c=g.stackIndex+1}b.stackIndex=c});this.onSeries=l}}});g(a,"Series/Windbarb/WindbarbPoint.js",[a["Core/Utilities.js"],a["Series/Column/ColumnSeries.js"]],function(a,d){var k=this&&this.__extends||function(){var a=function(c,d){a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,c){a.__proto__=c}||function(a,
c){for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])};return a(c,d)};return function(c,d){function g(){this.constructor=c}a(c,d);c.prototype=null===d?Object.create(d):(g.prototype=d.prototype,new g)}}(),g=a.isNumber;return function(a){function c(){var c=null!==a&&a.apply(this,arguments)||this;c.beaufort=void 0;c.beaufortLevel=void 0;c.direction=void 0;c.options=void 0;c.series=void 0;return c}k(c,a);c.prototype.isValid=function(){return g(this.value)&&0<=this.value};return c}(d.prototype.pointClass)});
g(a,"Series/Windbarb/WindbarbSeries.js",[a["Core/Animation/AnimationUtilities.js"],a["Core/Globals.js"],a["Mixins/OnSeries.js"],a["Core/Series/SeriesRegistry.js"],a["Core/Utilities.js"],a["Series/Windbarb/WindbarbPoint.js"]],function(a,d,g,p,c,t){var k=this&&this.__extends||function(){var a=function(c,b){a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,a){b.__proto__=a}||function(b,a){for(var n in a)a.hasOwnProperty(n)&&(b[n]=a[n])};return a(c,b)};return function(c,b){function e(){this.constructor=
c}a(c,b);c.prototype=null===b?Object.create(b):(e.prototype=b.prototype,new e)}}(),r=a.animObject;a=d.noop;var x=p.series,h=p.seriesTypes.column,y=c.extend,z=c.merge,A=c.pick;c=function(a){function c(){var b=null!==a&&a.apply(this,arguments)||this;b.data=void 0;b.options=void 0;b.points=void 0;return b}k(c,a);c.registerApproximation=function(){d.approximations&&!d.approximations.windbarb&&(d.approximations.windbarb=function(b,a){var c=0,f=0,e,g=b.length;for(e=0;e<g;e++)c+=b[e]*Math.cos(a[e]*d.deg2rad),
f+=b[e]*Math.sin(a[e]*d.deg2rad);return[b.reduce(function(a,b){return a+b},0)/b.length,Math.atan2(f,c)/d.deg2rad]})};c.prototype.init=function(a,e){c.registerApproximation();x.prototype.init.call(this,a,e)};c.prototype.pointAttribs=function(a,c){var b=this.options;a=a.color||this.color;var e=this.options.lineWidth;c&&(a=b.states[c].color||a,e=(b.states[c].lineWidth||e)+(b.states[c].lineWidthPlus||0));return{stroke:a,"stroke-width":e}};c.prototype.windArrow=function(a){var c=1.943844*a.value,b=this.options.vectorLength/
20,f=-10;if(a.isNull)return[];if(0===a.beaufortLevel)return this.chart.renderer.symbols.circle(-10*b,-10*b,20*b,20*b);a=[["M",0,7*b],["L",-1.5*b,7*b],["L",0,10*b],["L",1.5*b,7*b],["L",0,7*b],["L",0,-10*b]];var d=(c-c%50)/50;if(0<d)for(;d--;)a.push(-10===f?["L",0,f*b]:["M",0,f*b],["L",5*b,f*b+2],["L",0,f*b+4]),c-=50,f+=7;d=(c-c%10)/10;if(0<d)for(;d--;)a.push(-10===f?["L",0,f*b]:["M",0,f*b],["L",7*b,f*b]),c-=10,f+=3;d=(c-c%5)/5;if(0<d)for(;d--;)a.push(-10===f?["L",0,f*b]:["M",0,f*b],["L",4*b,f*b]),
c-=5,f+=3;return a};c.prototype.translate=function(){var a=this.beaufortFloor,c=this.beaufortName;g.translate.call(this);this.points.forEach(function(b){for(var d=0;d<a.length&&!(a[d]>b.value);d++);b.beaufortLevel=d-1;b.beaufort=c[d-1]})};c.prototype.drawPoints=function(){var a=this.chart,c=this.yAxis,d=a.inverted,f=this.options.vectorLength/2;this.points.forEach(function(b){var e=b.plotX,g=b.plotY;!1===this.options.clip||a.isInsidePlot(e,0)?(b.graphic||(b.graphic=this.chart.renderer.path().add(this.markerGroup).addClass("highcharts-point highcharts-color-"+
A(b.colorIndex,b.series.colorIndex))),b.graphic.attr({d:this.windArrow(b),translateX:e+this.options.xOffset,translateY:g+this.options.yOffset,rotation:b.direction}),this.chart.styledMode||b.graphic.attr(this.pointAttribs(b))):b.graphic&&(b.graphic=b.graphic.destroy());b.tooltipPos=[e+this.options.xOffset+(d&&!this.onSeries?f:0),g+this.options.yOffset-(d?0:f+c.pos-a.plotTop)]},this)};c.prototype.animate=function(b){b?this.markerGroup.attr({opacity:.01}):this.markerGroup.animate({opacity:1},r(this.options.animation))};
c.prototype.markerAttribs=function(b,a){return{}};c.prototype.getExtremes=function(){return{}};c.prototype.shouldShowTooltip=function(b,c,d){void 0===d&&(d={});d.ignoreX=this.chart.inverted;d.ignoreY=!d.ignoreX;return a.prototype.shouldShowTooltip.call(this,b,c,d)};c.defaultOptions=z(h.defaultOptions,{dataGrouping:{enabled:!0,approximation:"windbarb",groupPixelWidth:30},lineWidth:2,onSeries:null,states:{hover:{lineWidthPlus:0}},tooltip:{pointFormat:'<span style="color:{point.color}">\u25cf</span> {series.name}: <b>{point.value}</b> ({point.beaufort})<br/>'},
vectorLength:20,colorKey:"value",yOffset:-20,xOffset:0});return c}(h);y(c.prototype,{pointArrayMap:["value","direction"],parallelArrays:["x","value","direction"],beaufortName:"Calm;Light air;Light breeze;Gentle breeze;Moderate breeze;Fresh breeze;Strong breeze;Near gale;Gale;Strong gale;Storm;Violent storm;Hurricane".split(";"),beaufortFloor:[0,.3,1.6,3.4,5.5,8,10.8,13.9,17.2,20.8,24.5,28.5,32.7],trackerGroups:["markerGroup"],getPlotBox:g.getPlotBox,invertGroups:a});c.prototype.pointClass=t;c.registerApproximation();
p.registerSeriesType("windbarb",c);"";return c});g(a,"masters/modules/windbarb.src.js",[],function(){})});
//# sourceMappingURL=windbarb.js.map