/* Highcharts JS v8.0.0 (2019-12-10) Marker clusters module for Highcharts (c) 2010-2019 Wojciech Chmiel License: www.highcharts.com/license */ (function(k){"object"===typeof module&&module.exports?(k["default"]=k,module.exports=k):"function"===typeof define&&define.amd?define("highcharts/modules/marker-clusters",["highcharts"],function(w){k(w);k.Highcharts=w;return k}):k("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(k){function w(D,k,I,w){D.hasOwnProperty(k)||(D[k]=w.apply(null,I))}k=k?k._modules:{};w(k,"modules/marker-clusters.src.js",[k["parts/Globals.js"],k["parts/Utilities.js"]],function(k,w){function I(a){var b=a.length, d=0,f=0,c;for(c=0;cClustered points: {point.clusterPointsAmount}
"}});aa.prototype.symbols.cluster=function(a,b,d,f){d/=2;f/=2;var c=this.arc(a+d,b+f,d-4,f-4,{start:.5*Math.PI,end:2.5*Math.PI,open:!1});var l= this.arc(a+d,b+f,d-3,f-3,{start:.5*Math.PI,end:2.5*Math.PI,innerR:d-2,open:!1});return this.arc(a+d,b+f,d-1,f-1,{start:.5*Math.PI,end:2.5*Math.PI,innerR:d,open:!1}).concat(l,c)};u.prototype.animateClusterPoint=function(a){var b=this.xAxis,d=this.yAxis,f=this.chart,c=V((this.options.cluster||{}).animation),l=c.duration||500,h=(this.markerClusterInfo||{}).pointsState,t=(h||{}).newState,r=(h||{}).oldState,g=[],m=h=0,p=0,q=!1,v=!1;if(r&&t){var e=t[a.stateId];m=b.toPixels(e.x)-f.plotLeft;p=d.toPixels(e.y)- f.plotTop;if(1===e.parentsId.length){a=(t||{})[a.stateId].parentsId[0];var n=r[a];e.point&&e.point.graphic&&n&&n.point&&n.point.plotX&&n.point.plotY&&n.point.plotX!==e.point.plotX&&n.point.plotY!==e.point.plotY&&(a=e.point.graphic.getBBox(),h=a.width/2,e.point.graphic.attr({x:n.point.plotX-h,y:n.point.plotY-h}),e.point.graphic.animate({x:m-e.point.graphic.radius,y:p-e.point.graphic.radius},c,function(){v=!0;n.point&&n.point.destroy&&n.point.destroy()}),e.point.dataLabel&&e.point.dataLabel.alignAttr&& n.point.dataLabel&&n.point.dataLabel.alignAttr&&(e.point.dataLabel.attr({x:n.point.dataLabel.alignAttr.x,y:n.point.dataLabel.alignAttr.y}),e.point.dataLabel.animate({x:e.point.dataLabel.alignAttr.x,y:e.point.dataLabel.alignAttr.y},c)))}else 0===e.parentsId.length?(Q(e,!0,!0),G(function(){P(e,.1,c,!0,!0)},l/2)):(Q(e,!0,!0),e.parentsId.forEach(function(a){r&&r[a]&&(n=r[a],g.push(n),n.point&&n.point.graphic&&(q=!0,n.point.graphic.show(),n.point.graphic.animate({x:m-n.point.graphic.radius,y:p-n.point.graphic.radius, opacity:.4},c,function(){v=!0;K(e,g,c,.7)}),n.point.dataLabel&&-9999!==n.point.dataLabel.y&&e.point&&e.point.dataLabel&&e.point.dataLabel.alignAttr&&(n.point.dataLabel.show(),n.point.dataLabel.animate({x:e.point.dataLabel.alignAttr.x,y:e.point.dataLabel.alignAttr.y,opacity:.4},c))))}),G(function(){v||K(e,g,c,.85)},l),q||G(function(){K(e,g,c,.1)},l/2))}};u.prototype.getGridOffset=function(){var a=this.chart,b=this.xAxis,d=this.yAxis;b=this.dataMinX&&this.dataMaxX?b.reversed?b.toPixels(this.dataMaxX): b.toPixels(this.dataMinX):a.plotLeft;a=this.dataMinY&&this.dataMaxY?d.reversed?d.toPixels(this.dataMinY):d.toPixels(this.dataMaxY):a.plotTop;return{plotLeft:b,plotTop:a}};u.prototype.getScaledGridSize=function(a){var b=this.xAxis,d=!0,f=1,c=1;a=a.processedGridSize||C.layoutAlgorithm.gridSize;this.gridValueSize||(this.gridValueSize=Math.abs(b.toValue(a)-b.toValue(0)));b=b.toPixels(this.gridValueSize)-b.toPixels(0);for(b=+(a/b).toFixed(14);d&&1!==b;){var l=Math.pow(2,f);.75b?d=!1:b>=1/l&&b< 1/l*2?(d=!1,c=l):b<=l&&b>l/2&&(d=!1,c=1/l);f++}return a/c/b};u.prototype.getRealExtremes=function(){var a=this.chart,b=this.xAxis,d=this.yAxis;var f=b?b.toValue(a.plotLeft):0;b=b?b.toValue(a.plotLeft+a.plotWidth):0;var c=d?d.toValue(a.plotTop):0;a=d?d.toValue(a.plotTop+a.plotHeight):0;f>b&&(f=J([f,b],2),b=f[0],f=f[1]);c>a&&(c=J([c,a],2),a=c[0],c=c[1]);return{minX:f,maxX:b,minY:c,maxY:a}};u.prototype.onDrillToCluster=function(a){(a.point||a.target).firePointEvent("drillToCluster",a,function(a){var b= a.point||a.target,f=b.series.xAxis,c=b.series.yAxis,l=b.series.chart;if((b.series.options.cluster||{}).drillToCluster&&b.clusteredData){var h=b.clusteredData.map(function(a){return a.x}).sort(function(a,b){return a-b});var t=b.clusteredData.map(function(a){return a.y}).sort(function(a,b){return a-b});b=h[0];var r=h[h.length-1];h=t[0];var g=t[t.length-1];t=Math.abs(.1*(r-b));var m=Math.abs(.1*(g-h));l.pointer.zoomX=!0;l.pointer.zoomY=!0;b>r&&(r=J([r,b],2),b=r[0],r=r[1]);h>g&&(g=J([g,h],2),h=g[0],g= g[1]);l.zoom({originalEvent:a,xAxis:[{axis:f,min:b-t,max:r+t}],yAxis:[{axis:c,min:h-m,max:g+m}]})}})};u.prototype.getClusterDistancesFromPoint=function(a,b,d){var f=this.xAxis,c=this.yAxis,l=[],h;for(h=0;hc[e].oldX+1||c[e].posXc[e].oldY+1||c[e].posYr.minX||this.initMaxY&&this.initMaxYr.minY?(this.initMaxX=r.maxX,this.initMinX=r.minX,this.initMaxY=r.maxY,this.initMinY=r.minY,t=this.markerClusterAlgorithms?this.markerClusterAlgorithms.kmeans.call(this,a,b,d,f):{}, this.baseClusters=null):(this.baseClusters||(this.baseClusters={clusters:this.markerClusterInfo.clusters,noise:this.markerClusterInfo.noise}),this.baseClusters.clusters.forEach(function(a){a.pointsOutside=[];a.pointsInside=[];a.data.forEach(function(b){p=Math.sqrt(Math.pow(c.toPixels(b.x)-c.toPixels(a.x),2)+Math.pow(l.toPixels(b.y)-l.toPixels(a.y),2));q=a.clusterZone&&a.clusterZone.marker&&a.clusterZone.marker.radius?a.clusterZone.marker.radius:g&&g.radius?g.radius:C.marker.radius;m=0<=h-q?h-q:q; p>q+m&&B(a.pointsOutside)?a.pointsOutside.push(b):B(a.pointsInside)&&a.pointsInside.push(b)});a.pointsInside.length&&(t[a.id]=a.pointsInside);a.pointsOutside.forEach(function(b,f){t[a.id+"_noise"+f]=[b]})}),this.baseClusters.noise.forEach(function(a){t[a.id]=a.data}));return t}};u.prototype.preventClusterCollisions=function(a){var b=this.xAxis,d=this.yAxis,f=J(a.key.split("-").map(parseFloat),2),c=f[0],l=f[1],h=a.gridSize,t=a.groupedData,r=a.defaultRadius,g=a.clusterRadius,m=l*h,p=c*h,q=b.toPixels(a.x), v=d.toPixels(a.y);f=[];var e=0,n=0,k=(this.options.cluster||{}).marker,x=(this.options.cluster||{}).zones,u=this.getGridOffset(),w,A,z,D,E,G,H;q-=u.plotLeft;v-=u.plotTop;for(z=1;5>z;z++){var F=z%2?-1:1;var y=3>z?-1:1;F=Math.floor((q+F*g)/h);y=Math.floor((v+y*g)/h);F=[y+"-"+F,y+"-"+l,c+"-"+F];for(y=0;y=x[z].from&&e<=x[z].to&&(n=B((x[z].marker||{}).radius)?x[z].marker.radius||0:k&&k.radius?k.radius:C.marker.radius);1D-l?m+g:m+h-g);E!==c&&Math.abs(v-A)E-c?p+g:p+h-g)}});f=b.toValue(q+u.plotLeft);y=d.toValue(v+u.plotTop);t[a.key].posX=f;t[a.key].posY=y;return{x:f,y:y}};u.prototype.isValidGroupedDataObject= function(a){var b=!1,d;if(!N(a))return!1;R(a,function(a){b=!0;if(S(a)&&a.length)for(d=0;d=r){var p=a[m];var q= Math.random().toString(36).substring(2,7)+"-"+X++;var k=p.length;if(b.zones)for(g=0;g=b.zones[g].from&&k<=b.zones[g].to){var e=b.zones[g];e.zoneIndex=g;var n=b.zones[g].marker;var u=b.zones[g].className}var x=I(p);"grid"!==b.layoutAlgorithm.type||b.allowOverlap?x={x:x.x,y:x.y}:(g=this.options.marker||{},x=this.preventClusterCollisions({x:x.x,y:x.y,key:m,groupedData:a,gridSize:this.getScaledGridSize(b.layoutAlgorithm),defaultRadius:g.radius||3+(g.lineWidth||0),clusterRadius:n&& n.radius?n.radius:(b.marker||{}).radius||C.marker.radius}));for(g=0;g=l.minX-d&&a.xData[q]<=l.maxX+d&&(a.yData[q]||l.minY)>=l.minY-f&&(a.yData[q]||l.maxY)<=l.maxY+f&&(h.push(a.xData[q]),k.push(a.yData[q]),r.push(q))}B(n)&&B(g)&&E(u)&&E(m)&&(a.dataMaxX=n,a.dataMinX=g,a.dataMaxY=u,a.dataMinY=m);l=O(v)?v:a.markerClusterAlgorithms?v&&a.markerClusterAlgorithms[v]?a.markerClusterAlgorithms[v]:h.length< b?a.markerClusterAlgorithms.kmeans:a.markerClusterAlgorithms.grid:function(){return!1};e=(h=l.call(this,h,k,r,e))?a.getClusteredData(h,c):h;c.animation&&a.markerClusterInfo&&a.markerClusterInfo.pointsState&&a.markerClusterInfo.pointsState.oldState?(Y(a.markerClusterInfo.pointsState.oldState),h=a.markerClusterInfo.pointsState.newState):h={};k=a.xData.length;r=a.markerClusterInfo;e&&(a.processedXData=e.groupedXData,a.processedYData=e.groupedYData,a.hasGroupedData=!0,a.markerClusterInfo=e,a.groupMap= e.groupMap);W.apply(this);e&&a.markerClusterInfo&&((a.markerClusterInfo.clusters||[]).forEach(function(b){p=a.points[b.index];p.isCluster=!0;p.clusteredData=b.data;p.clusterPointsAmount=b.data.length;b.point=p;A(p,"click",a.onDrillToCluster)}),(a.markerClusterInfo.noise||[]).forEach(function(b){b.point=a.points[b.index]}),c.animation&&a.markerClusterInfo&&(a.markerClusterInfo.pointsState={oldState:h,newState:a.getPointsState(e,r,k)}),c.animation?this.hideClusteredData():this.destroyClusteredData(), this.markerClusterSeriesData=this.hasGroupedData?this.points:null)}else W.apply(this)};A(k.Chart,"render",function(){(this.series||[]).forEach(function(a){if(a.markerClusterInfo){var b=((a.markerClusterInfo||{}).pointsState||{}).oldState;(a.options.cluster||{}).animation&&a.markerClusterInfo&&0===a.chart.pointer.pinchDown.length&&"pan"!==(a.xAxis.eventArgs||{}).trigger&&b&&Object.keys(b).length&&(a.markerClusterInfo.clusters.forEach(function(b){a.animateClusterPoint(b)}),a.markerClusterInfo.noise.forEach(function(b){a.animateClusterPoint(b)}))}})}); A(Z,"update",function(){if(this.dataGroup)return U("Highcharts marker-clusters module: Running `Point.update` when point belongs to clustered series is not supported.",!1,this.series.chart),!1});A(L,"destroy",u.prototype.destroyClusteredData);A(L,"afterRender",function(){var a=(this.options.cluster||{}).drillToCluster;this.markerClusterInfo&&this.markerClusterInfo.clusters&&this.markerClusterInfo.clusters.forEach(function(b){b.point&&b.point.graphic&&(b.point.graphic.addClass("highcharts-cluster-point"), a&&b.point&&(b.point.graphic.css({cursor:"pointer"}),b.point.dataLabel&&b.point.dataLabel.css({cursor:"pointer"})),B(b.clusterZone)&&b.point.graphic.addClass(b.clusterZoneClassName||"highcharts-cluster-zone-"+b.clusterZone.zoneIndex))})});A(k.Point,"drillToCluster",function(a){var b=(((a.point||a.target).series.options.cluster||{}).events||{}).drillToCluster;O(b)&&b.call(this,a)});A(k.Axis,"setExtremes",function(){var a=this.chart,b=0,d;a.series.forEach(function(a){a.markerClusterInfo&&(d=V((a.options.cluster|| {}).animation),b=d.duration||0)});G(function(){a.tooltip&&a.tooltip.destroy()},b)})});w(k,"masters/modules/marker-clusters.src.js",[],function(){})}); //# sourceMappingURL=marker-clusters.js.map