/*
 Highcharts JS v7.2.0 (2019-09-03)

 Wind barb series module

 (c) 2010-2019 Torstein Honsi

 License: www.highcharts.com/license
*/
(function(b){"object"===typeof module&&module.exports?(b["default"]=b,module.exports=b):"function"===typeof define&&define.amd?define("highcharts/modules/windbarb",["highcharts"],function(f){b(f);b.Highcharts=f;return b}):b("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(b){function f(b,h,f,m){b.hasOwnProperty(h)||(b[h]=m.apply(null,f))}b=b?b._modules:{};f(b,"mixins/on-series.js",[b["parts/Globals.js"],b["parts/Utilities.js"]],function(b,h){var t=h.defined,f=b.seriesTypes,u=b.stableSort;
return{getPlotBox:function(){return b.Series.prototype.getPlotBox.call(this.options.onSeries&&this.chart.get(this.options.onSeries)||this)},translate:function(){f.column.prototype.translate.apply(this);var b=this,g=b.options,a=b.chart,k=b.points,d=k.length-1,e,c=g.onSeries;c=c&&a.get(c);g=g.onKey||"y";var h=c&&c.options.step,p=c&&c.points,n=p&&p.length,m=a.inverted,r=b.xAxis,x=b.yAxis,v=0,q;if(c&&c.visible&&n){v=(c.pointXOffset||0)+(c.barW||0)/2;a=c.currentDataGrouping;var y=p[n-1].x+(a?a.totalRange:
0);u(k,function(a,c){return a.x-c.x});for(g="plot"+g[0].toUpperCase()+g.substr(1);n--&&k[d];){var l=p[n];a=k[d];a.y=l.y;if(l.x<=a.x&&void 0!==l[g]){if(a.x<=y&&(a.plotY=l[g],l.x<a.x&&!h&&(q=p[n+1])&&void 0!==q[g])){var w=(a.x-l.x)/(q.x-l.x);a.plotY+=w*(q[g]-l[g]);a.y+=w*(q.y-l.y)}d--;n++;if(0>d)break}}}k.forEach(function(a,c){a.plotX+=v;if(void 0===a.plotY||m)0<=a.plotX&&a.plotX<=r.len?m?(a.plotY=r.translate(a.x,0,1,0,1),a.plotX=t(a.y)?x.translate(a.y,0,0,0,1):0):a.plotY=(r.opposite?0:b.yAxis.len)+
r.offset:a.shapeArgs={};if((e=k[c-1])&&e.plotX===a.plotX){void 0===e.stackIndex&&(e.stackIndex=0);var d=e.stackIndex+1}a.stackIndex=d});this.onSeries=c}}});f(b,"modules/windbarb.src.js",[b["parts/Globals.js"],b["parts/Utilities.js"],b["mixins/on-series.js"]],function(b,h,f){function m(){b.approximations&&!b.approximations.windbarb&&(b.approximations.windbarb=function(a,k){var d=0,e=0,c,f=a.length;for(c=0;c<f;c++)d+=a[c]*Math.cos(k[c]*b.deg2rad),e+=a[c]*Math.sin(k[c]*b.deg2rad);return[a.reduce(function(a,
c){return a+c},0)/a.length,Math.atan2(e,d)/b.deg2rad]})}var u=h.isNumber;h=b.noop;var t=b.pick,g=b.seriesType;m();g("windbarb","column",{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},{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"],init:function(a,k){m();b.Series.prototype.init.call(this,a,k)},pointAttribs:function(a,b){var d=this.options;a=a.color||this.color;var e=this.options.lineWidth;b&&(a=d.states[b].color||a,e=(d.states[b].lineWidth||
e)+(d.states[b].lineWidthPlus||0));return{stroke:a,"stroke-width":e}},markerAttribs:function(){},getPlotBox:f.getPlotBox,windArrow:function(a){var b=1.943844*a.value,d=this.options.vectorLength/20,e=-10;if(a.isNull)return[];if(0===a.beaufortLevel)return this.chart.renderer.symbols.circle(-10*d,-10*d,20*d,20*d);a=["M",0,7*d,"L",-1.5*d,7*d,0,10*d,1.5*d,7*d,0,7*d,0,-10*d];var c=(b-b%50)/50;if(0<c)for(;c--;)a.push(-10===e?"L":"M",0,e*d,"L",5*d,e*d+2,"L",0,e*d+4),b-=50,e+=7;c=(b-b%10)/10;if(0<c)for(;c--;)a.push(-10===
e?"L":"M",0,e*d,"L",7*d,e*d),b-=10,e+=3;c=(b-b%5)/5;if(0<c)for(;c--;)a.push(-10===e?"L":"M",0,e*d,"L",4*d,e*d),b-=5,e+=3;return a},translate:function(){var a=this.beaufortFloor,b=this.beaufortName;f.translate.call(this);this.points.forEach(function(d){for(var e=0;e<a.length&&!(a[e]>d.value);e++);d.beaufortLevel=e-1;d.beaufort=b[e-1]})},drawPoints:function(){var a=this.chart,b=this.yAxis,d=a.inverted,e=this.options.vectorLength/2;this.points.forEach(function(c){var f=c.plotX,g=c.plotY;!1===this.options.clip||
a.isInsidePlot(f,0,!1)?(c.graphic||(c.graphic=this.chart.renderer.path().add(this.markerGroup).addClass("highcharts-point highcharts-color-"+t(c.colorIndex,c.series.colorIndex))),c.graphic.attr({d:this.windArrow(c),translateX:f+this.options.xOffset,translateY:g+this.options.yOffset,rotation:c.direction}),this.chart.styledMode||c.graphic.attr(this.pointAttribs(c))):c.graphic&&(c.graphic=c.graphic.destroy());c.tooltipPos=[f+this.options.xOffset+(d&&!this.onSeries?e:0),g+this.options.yOffset-(d?0:e+
b.pos-a.plotTop)]},this)},animate:function(a){a?this.markerGroup.attr({opacity:.01}):(this.markerGroup.animate({opacity:1},b.animObject(this.options.animation)),this.animate=null)},invertGroups:h,getExtremes:h},{isValid:function(){return u(this.value)&&0<=this.value}})});f(b,"masters/modules/windbarb.src.js",[],function(){})});
//# sourceMappingURL=windbarb.js.map