highcharts
Version:
JavaScript charting framework
10 lines • 7.88 kB
JavaScript
!/**
* Highcharts JS v12.6.0 (2026-04-13)
* @module highcharts/modules/geoheatmap
* @requires highcharts
*
* (c) 2009-2026
*
* A commercial license may be required depending on use.
* See www.highcharts.com/license
*/function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(t._Highcharts,t._Highcharts.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/modules/geoheatmap",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/modules/geoheatmap"]=e(t._Highcharts,t._Highcharts.SeriesRegistry):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(t,e)=>(()=>{"use strict";var i={512:t=>{t.exports=e},944:e=>{e.exports=t}},o={};function r(t){var e=o[t];if(void 0!==e)return e.exports;var a=o[t]={exports:{}};return i[t](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var a={};r.d(a,{default:()=>T});var n=r(944),s=r.n(n),l=r(512),p=r.n(l);let{doc:h,win:c}=s();function d(t){return g(t)&&"number"==typeof t.nodeType}function u(t){return"number"==typeof t&&!isNaN(t)&&t<1/0&&t>-1/0}function g(t,e){let i;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(i=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==i)}function y(t,...e){let i,o=[t,...e],r={},a=function(t,e){return"object"!=typeof t&&(t={}),function(t,e,i){for(let o in t)Object.hasOwnProperty.call(t,o)&&e.call(i||t[o],t[o],o,t)}(e,function(i,o){if("__proto__"!==o&&"constructor"!==o){let r;!g(i,!0)||(r=i?.constructor,g(i,!0)&&!d(i)&&r?.name&&"Object"!==r.name)||d(i)?t[o]=e[o]:t[o]=a(t[o]||{},i)}}),t};!0===t&&(r=o[1],o=Array.prototype.slice.call(o,2));let n=o.length;for(i=0;i<n;i++)r=a(r,o[i]);return r}Array.prototype.find;function f(){let t=arguments,e=t.length;for(let i=0;i<e;i++){let e=t[i];if(null!=e)return e}}let{map:{prototype:{pointClass:m}}}=p().seriesTypes,b=class extends m{applyOptions(t,e){let i=super.applyOptions.call(this,t,e),{lat:o,lon:r}=i.options;if(u(r)&&u(o)){let{colsize:t=1,rowsize:e=1}=this.series.options,a=r-t/2,n=o-e/2;i.geometry=i.options.geometry={type:"Polygon",coordinates:[[[a,n],[a+t,n],[a+t,n+e],[a,n+e],[a,n]]]}}return i}},{doc:x}=s(),{animObject:v,stop:w}=s(),{noop:D}=s(),{colorFromPoint:j,getContext:C}={colorFromPoint:function(t,e){let i=e.series.colorAxis;if(i){let o=i.toColor(t||0,e).split(")")[0].split("(")[1].split(",").map(t=>f(parseFloat(t),parseInt(t,10)));return o[3]=255*f(o[3],1),null!=t&&e.visible||(o[3]=0),o}return[0,0,0,0]},getContext:function(t){let{canvas:e,context:i}=t;return e&&i?.clearRect?(i.clearRect(0,0,e.width,e.height),i):(t.canvas=x.createElement("canvas"),t.context=t.canvas.getContext("2d",{willReadFrequently:!0})||void 0,t.context)}},{seriesTypes:{map:P}}=p();function O(t){return t-360*Math.floor((t+180)/360)}class I extends P{constructor(){super(...arguments),this.isDirtyCanvas=!0}update(){this.options=y(this.options,arguments[0]),this.getInterpolation().enabled&&(this.isDirtyCanvas=!0,this.points.forEach(t=>{t.graphic&&(t.graphic.destroy(),delete t.graphic)})),super.update.apply(this,arguments)}translate(){(!this.getInterpolation().enabled||!this.image||this.isDirty||this.isDirtyData)&&super.translate.apply(this,arguments)}getInterpolation(){return g(this.options.interpolation)?this.options.interpolation:{blur:1,enabled:this.options.interpolation}}drawPoints(){let t=this.chart.mapView,e=this.options;if(this.getInterpolation().enabled&&t&&this.bounds){let o=this.context||C(this),{canvas:r,colorAxis:a,image:s,chart:l,points:p}=this,[h,c]=[f(e.colsize,1),f(e.rowsize,1)],d=t.projectedUnitsToPixels({x:this.bounds.x1,y:this.bounds.y2}),g=t.projectedUnitsToPixels({x:this.bounds.x2,y:this.bounds.y1});if(r&&o&&a&&d&&g){let{x:e,y:a}=d,f=g.x-e,m=g.y-a,b={x:e,y:a,width:f,height:m};if(this.isDirtyCanvas||this.isDirtyData||"Orthographic"===t.projection.options.name){let s=r.width=~~(360/h)+1,l=r.height=~~(180/c)+1,d=new Uint8ClampedArray(s*l*4),{lat:g=0,lon:y=0}=p[0].options,b=y%c!=0,x=g%h!=0,v=b?t=>Math.round(t/c)*c:t=>t,w=x?t=>Math.round(t/h)*h:t=>t,D=p.length;(b||x)&&(0,n.error)("Highcharts Warning: For best performance, lon/lat datapoints should spaced by a single colsize/rowsize",!1,this.chart,{colsize:String(h),rowsize:String(c)}),this.directTouch=!1,this.isDirtyCanvas=!0;for(let t=0;t<D;t++){var i;let e=p[t],{lon:o,lat:r}=e.options;u(o)&&u(r)&&d.set(j(e.value,e),4*(i=v(o),Math.ceil(s*(l-1-(w(r)+90)/c)+(i+180)/h)))}let C=this.getInterpolation().blur,P=0===C?1:11*C,O=~~(s*P),I=~~(l*P),T=~~f,A=~~m,L=new ImageData(d,s,l);r.width=O,r.height=I,o.putImageData(L,0,0),o.globalCompositeOperation="copy",o.drawImage(r,0,0,L.width,L.height,0,0,O,I);let R=this.getProjectedImageData(t,T,A,o.getImageData(0,0,O,I),r,e,a);r.width=T,r.height=A,o.putImageData(new ImageData(R,T,A),0,0)}if(s)if(l.renderer.globalAnimation&&l.hasRendered){let t=Number(s.attr("x")),i=Number(s.attr("y")),o=Number(s.attr("width")),n=Number(s.attr("height")),p=(r,l)=>{let p=l.pos;s.attr({x:t+(e-t)*p,y:i+(a-i)*p,width:o+(f-o)*p,height:n+(m-n)*p})},h=y(v(l.renderer.globalAnimation)),c=h.step;h.step=function(){c&&c.apply(this,arguments),p.apply(this,arguments)},s.attr(y({animator:0},this.isDirtyCanvas?{href:r.toDataURL("image/png",1)}:void 0)).animate({animator:1},h)}else w(s),s.attr(y(b,this.isDirtyCanvas?{href:r.toDataURL("image/png",1)}:void 0));else this.image=l.renderer.image(r.toDataURL("image/png",1)).attr(b).add(this.group);this.isDirtyCanvas=!1}}else super.drawPoints.apply(this,arguments)}getProjectedImageData(t,e,i,o,r,a,n){let s=new Uint8ClampedArray(e*i*4),l=f(t.projection.options.rotation?.[0],0),p=r.width/360,h=-1*r.height/180,c=-1;for(let i=0;i<s.length;i+=4){let d=i/4%e;0===d&&c++;let u=t.pixelsToLonLat({x:a+d,y:n+c});if(u){u.lon>-180-l&&u.lon<180-l&&(u.lon=O(u.lon));let t=[u.lon,u.lat],e=t[0]*p+r.width/2,a=t[1]*h+r.height/2;if(e>=0&&e<=r.width&&a>=0&&a<=r.height){let t=Math.floor(a)*r.width*4+4*Math.round(e);s[i]=o.data[t],s[i+1]=o.data[t+1],s[i+2]=o.data[t+2],s[i+3]=o.data[t+3]}}}return s}searchPoint(t,e){let i=this.chart,o=i.mapView;if(o&&this.bounds&&this.image&&i.tooltip&&i.tooltip.options.enabled)if(!i.pointer.hasDragged&&(.01>=+this.image.attr("animator")||+this.image.attr("animator")>=.99)){let r=o.projectedUnitsToPixels({x:this.bounds.x1,y:this.bounds.y2}),a=o.projectedUnitsToPixels({x:this.bounds.x2,y:this.bounds.y1});if(i.pointer.normalize(t),t.lon&&t.lat&&r&&a&&t.chartX-i.plotLeft>r.x&&t.chartX-i.plotLeft<a.x&&t.chartY-i.plotTop>r.y&&t.chartY-i.plotTop<a.y)return this.searchKDTree({clientX:t.chartX,lon:O(t.lon),lat:t.lat},e,t)}else i.tooltip.destroy()}}I.defaultOptions=y(P.defaultOptions,{nullColor:"transparent",tooltip:{pointFormat:"Lat: {point.lat}, Lon: {point.lon}, Value: {point.value}<br/>"},borderWidth:0,colsize:1,rowsize:1,stickyTracking:!0,interpolation:{enabled:!1,blur:1}}),function(t,e,i,o={}){let r="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(r,"hcEvents")||(r.hcEvents={});let a=r.hcEvents;s().Point&&t instanceof s().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let n=t.addEventListener;n&&n.call(t,e,i,!!s().supportsPassiveEvents&&{passive:void 0===o.passive?-1!==e.indexOf("touch"):o.passive,capture:!1}),a[e]||(a[e]=[]);let l={fn:i,order:"number"==typeof o.order?o.order:1/0};a[e].push(l),a[e].sort((t,e)=>t.order-e.order)}(I,"afterDataClassLegendClick",function(){this.isDirtyCanvas=!0,this.drawPoints()}),function(t,e){let i;for(i in t||(t={}),e)t[i]=e[i]}(I.prototype,{type:"geoheatmap",applyJitter:D,pointClass:b,pointArrayMap:["lon","lat","value"],kdAxisArray:["lon","lat"]}),p().registerSeriesType("geoheatmap",I);let T=s();return a.default})());