Icard/angular-clarity-master(work.../node_modules/highcharts/modules/flowmap.js

7 lines
5.7 KiB
JavaScript
Raw Normal View History

2024-07-16 14:55:36 +00:00
!/**
* Highcharts JS v11.4.1 (2024-04-04)
*
* (c) 2009-2024
*
* 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/modules/flowmap",["highcharts"],function(o){return t(o),t.Highcharts=o,t}):t("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(t){"use strict";var o=t?t._modules:{};function e(t,o,e,i){t.hasOwnProperty(o)||(t[o]=i.apply(null,e),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:o,module:t[o]}})))}e(o,"Series/FlowMap/FlowMapPoint.js",[o["Core/Series/SeriesRegistry.js"],o["Core/Utilities.js"]],function(t,o){let{seriesTypes:{mapline:{prototype:{pointClass:e}}}}=t,{pick:i,isString:s,isNumber:r}=o;return class extends e{isValid(){let t=!!(this.options.to&&this.options.from);return[this.options.to,this.options.from].forEach(function(o){t=!!(t&&o&&(s(o)||r(i(o[0],o.lat))&&r(i(o[1],o.lon))))}),t}}}),e(o,"Series/FlowMap/FlowMapSeries.js",[o["Series/FlowMap/FlowMapPoint.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Utilities.js"]],function(t,o,e){let{series:{prototype:{pointClass:i}},seriesTypes:{column:s,map:r,mapline:n}}=o,{addEvent:a,arrayMax:l,arrayMin:h,defined:p,extend:f,isArray:d,merge:m,pick:u,relativeLength:c}=e;class g extends n{static getLength(t,o){return Math.sqrt(t*t+o*o)}static normalize(t,o){let e=this.getLength(t,o);return[t/e,o/e]}static markerEndPath(t,o,e,i){let s=c(i.width||0,this.getLength(o[0]-t[0],o[1]-t[1])),r=i.markerType||"arrow",[n,a]=this.normalize(o[0]-t[0],o[1]-t[1]),l=[];if("arrow"===r){let[i,r]=t;i-=n*s,r-=a*s,l.push(["L",i,r]),l.push(["L",e[0],e[1]]),[i,r]=o,i+=n*s,r+=a*s,l.push(["L",i,r])}if("mushroom"===r){let[i,r]=t,[h,p]=o,[f,d]=e,m=(h-i)/2+i,u=(p-r)/2+r;i-=n*s,r-=a*s,l.push(["L",i,r]),h+=n*s,p+=a*s,l.push(["Q",(f-m)*2+m,(d-u)*2+u,h,p])}return l}animate(t){let o=this.points;t||o.forEach(t=>{if(t.shapeArgs&&d(t.shapeArgs.d)&&t.shapeArgs.d.length){let o=t.shapeArgs.d,e=o[0][1],i=o[0][2];if(e&&i){let s=[];for(let t=0;t<o.length;t++){s.push([...o[t]]);for(let r=1;r<o[t].length;r++)s[t][r]=r%2?e:i}t.graphic&&(t.graphic.attr({d:s}),t.graphic.animate({d:o}))}}})}getLinkWidth(t){let o=this.options.width,e=t.options.weight||this.options.weight;if(t.options.weight=e,o&&!e)return o;let i=this.smallestWeight,s=this.greatestWeight;if(!p(e)||!i||!s)return 0;let r=this.options.minWidth;return(e-i)*(this.options.maxWidth-r)/(s-i||1)+r}autoCurve(t,o,e,i,s,r){let n={x:e-t,y:i-o},a={x:(e-t)/2+t,y:(i-o)/2+o},l={x:a.x-s,y:a.y-r},h=n.x*l.x+n.y*l.y,p=Math.atan2(n.x*l.y-n.y*l.x,h),f=180*p/Math.PI;return f<0&&(f=360+f),-(.7*Math.sin(p=f*Math.PI/180))}pointAttribs(t,o){let e=r.prototype.pointAttribs.call(this,t,o);return e.fill=u(t.options.fillColor,t.options.color,"none"===this.options.fillColor?null:this.options.fillColor,this.color),e["fill-opacity"]=u(t.options.fillOpacity,this.options.fillOpacity),e["stroke-width"]=u(t.options.lineWidth,this.options.lineWidth,1),t.options.opacity&&(e.opacity=t.options.opacity),e}translate(){this.chart.hasRendered&&(this.isDirtyData||!this.hasRendered)&&(this.processData(),this.generatePoints());let t=[],o=0,e=0;this.points.forEach(s=>{let r,n;let l=this.chart,h=l.mapView,p=s.options,f=()=>{s.series.isDirty=!0},m=t=>{let o=l.get(t);if(o instanceof i&&o.plotX&&o.plotY)return a(o,"update",f),{x:o.plotX,y:o.plotY}},c=t=>d(t)?{lon:t[0],lat:t[1]}:t;"string"==typeof p.from?r=m(p.from):"object"==typeof p.from&&h&&(r=h.lonLatToPixels(c(p.from))),"string"==typeof p.to?n=m(p.to):"object"==typeof p.to&&h&&(n=h.lonLatToPixels(c(p.to))),s.fromPos=r,s.toPos=n,r&&n&&(o+=(r.x+n.x)/2,e+=(r.y+n.y)/2),u(s.options.weight,this.options.weight)&&t.push(u(s.options.weight,this.options.weight))}),this.smallestWeight=h(t),this.greatestWeight=l(t),this.centerOfPoints={x:o/this.points.length,y:e/this.points.length},this.points.forEach(t=>{if(!this.getLinkWidth(t)){t.shapeArgs={d:[]};return}t.fromPos&&(t.plotX=t.fromPos.x,t.plotY=t.fromPos.y),t.shapeType="path",t.shapeArgs=this.getPointShapeArgs(t),t.color=u(t.options.color,t.series.color)})}getPointShapeArgs(t){let{fromPos:o,toPos:e}=t;if(!o||!e)retu