highcharts
Version:
JavaScript charting framework
13 lines • 11.6 kB
JavaScript
!/**
* Highmaps JS v12.6.0 (2026-04-13)
* @module highcharts/modules/tilemap
* @requires highcharts
* @requires highcharts/modules/map
*
* Tilemap module
*
* (c) 2010-2026 Highsoft AS
*
* 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,t._Highcharts.Color):"function"==typeof define&&define.amd?define("highcharts/modules/tilemap",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry,t.Color)}):"object"==typeof exports?exports["highcharts/modules/tilemap"]=e(t._Highcharts,t._Highcharts.SeriesRegistry,t._Highcharts.Color):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry,t.Highcharts.Color)}("u"<typeof window?this:window,(t,e,o)=>(()=>{"use strict";var i,r={512:t=>{t.exports=e},620:t=>{t.exports=o},944:e=>{e.exports=t}},n={};function s(t){var e=n[t];if(void 0!==e)return e.exports;var o=n[t]={exports:{}};return r[t](o,o.exports,s),o.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var o in e)s.o(e,o)&&!s.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var a={};s.d(a,{default:()=>N});var l=s(944),h=s.n(l),p=s(512),c=s.n(p),d=s(620),u=s.n(d);let{doc:f,win:y}=h();function g(t,e,o,i={}){let r="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(r,"hcEvents")||(r.hcEvents={});let n=r.hcEvents;h().Point&&t instanceof h().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let s=t.addEventListener;s&&s.call(t,e,o,!!h().supportsPassiveEvents&&{passive:void 0===i.passive?-1!==e.indexOf("touch"):i.passive,capture:!1}),n[e]||(n[e]=[]);let a={fn:o,order:"number"==typeof i.order?i.order:1/0};return n[e].push(a),n[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,o){function i(e,o){let i=t.removeEventListener;i&&i.call(t,e,o,!1)}function r(o){let r,n;t.nodeName&&(e?(r={})[e]=!0:r=o,M(r,function(t,e){if(o[e])for(n=o[e].length;n--;)i(e,o[e][n].fn)}))}let n="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(n,"hcEvents")){let t=n.hcEvents;if(e){let n=t[e]||[];o?(t[e]=n.filter(function(t){return o!==t.fn}),i(e,o)):(r(t),t[e]=[])}else r(t),delete n.hcEvents}}(t,e,o)}}function x(t,e,o){return t>e?t<o?t:o:e}function b(t,e){let o;for(o in t||(t={}),e)t[o]=e[o];return t}function m(t){return P(t)&&"number"==typeof t.nodeType}function A(t){let e=Object.prototype.toString.call(t);return"[object Array]"===e||"[object Array Iterator]"===e}function P(t,e){return!!t&&"object"==typeof t&&(!e||!A(t))}function v(t,...e){let o,i=[t,...e],r={},n=function(t,e){return"object"!=typeof t&&(t={}),M(e,function(o,i){if("__proto__"!==i&&"constructor"!==i){let r;!P(o,!0)||(r=o?.constructor,P(o,!0)&&!m(o)&&r?.name&&"Object"!==r.name)||m(o)?t[i]=e[i]:t[i]=n(t[i]||{},o)}}),t};!0===t&&(r=i[1],i=Array.prototype.slice.call(i,2));let s=i.length;for(o=0;o<s;o++)r=n(r,i[o]);return r}function M(t,e,o){for(let i in t)Object.hasOwnProperty.call(t,i)&&e.call(o||t[i],t[i],i,t)}function L(){let t=arguments,e=t.length;for(let o=0;o<e;o++){let e=t[o];if(null!=e)return e}}Array.prototype.find;let{parse:S}=u();!function(t){let e;function o(){let{userOptions:t}=this;if(this.colorAxis=[],t.colorAxis){var o;t.colorAxis=A(o=t.colorAxis)?o:[o],t.colorAxis.map(t=>new e(this,t))}}function i(t){let e=this.chart.colorAxis||[],o=e=>{let o=t.allItems.indexOf(e);-1!==o&&(this.destroyItem(t.allItems[o]),t.allItems.splice(o,1))},i=[],r,n;for(e.forEach(function(t){r=t.options,r?.showInLegend&&(r.dataClasses&&r.visible?i=i.concat(t.getDataClassLegendSymbols()):r.visible&&i.push(t),t.series.forEach(function(t){(!t.options.showInLegend||r.dataClasses)&&("point"===t.options.legendType?t.points.forEach(function(t){o(t)}):o(t))}))}),n=i.length;n--;)t.allItems.unshift(i[n])}function r(t){t.visible&&t.item.legendColor&&t.item.legendItem.symbol.attr({fill:t.item.legendColor})}function n(t){this.chart.colorAxis?.forEach(e=>{e.update({},t.redraw)})}function s(){(this.chart.colorAxis?.length||this.colorAttribs)&&this.translateColors()}function a(){let t=this.axisTypes;t?-1===t.indexOf("colorAxis")&&t.push("colorAxis"):this.axisTypes=["colorAxis"]}function l(t){let e=this,o=t?"show":"hide";e.visible=e.options.visible=!!t,["graphic","dataLabel"].forEach(function(t){e[t]&&e[t][o]()}),this.series.buildKDTree()}function h(){let t=this,e=this.getPointsCollection(),o=this.options.nullColor,i=this.colorAxis,r=this.colorKey;e.forEach(e=>{let n=e.getNestedProperty(r),s=e.options.color||(e.isNull||null===e.value?o:i&&void 0!==n?i.toColor(n,e):e.color||t.color);s&&e.color!==s&&(e.color=s,"point"===t.options.legendType&&e.legendItem&&e.legendItem.label&&t.chart.legend.colorizeItem(e,e.visible))})}function p(){this.elem.attr("fill",S(this.start).tweenTo(S(this.end),this.pos),void 0,!0)}function c(){this.elem.attr("stroke",S(this.start).tweenTo(S(this.end),this.pos),void 0,!0)}t.compose=function(t,d,u,f,y){var x;let m,A=d.prototype,P=u.prototype,M=y.prototype;A.collectionsWithUpdate.includes("colorAxis")||(e=t,A.collectionsWithUpdate.push("colorAxis"),A.collectionsWithInit.colorAxis=[A.addColorAxis],g(d,"afterCreateAxes",o),m=(x=d).prototype.createAxis,x.prototype.createAxis=function(t,o){if("colorAxis"!==t)return m.apply(this,arguments);let i=new e(this,v(o.axis,{index:this[t].length,isX:!1}));return this.isDirtyLegend=!0,this.axes.forEach(t=>{t.series=[]}),this.series.forEach(t=>{t.bindAxes(),t.isDirtyData=!0}),L(o.redraw,!0)&&this.redraw(o.animation),i},P.fillSetter=p,P.strokeSetter=c,g(f,"afterGetAllItems",i),g(f,"afterColorizeItem",r),g(f,"afterUpdate",n),b(M,{optionalAxis:"colorAxis",translateColors:h}),b(M.pointClass.prototype,{setVisible:l}),g(y,"afterTranslate",s,{order:1}),g(y,"bindAxes",a))},t.pointSetVisible=l}(i||(i={}));let C=i,{series:{prototype:{pointClass:w}},seriesTypes:{heatmap:{prototype:{pointClass:T}}}}=c();class E extends T{haloPath(){return this.series.tileShape.haloPath.apply(this,arguments)}}b(E.prototype,{setState:w.prototype.setState,setVisible:C.pointSetVisible});let{noop:O}=h(),{heatmap:I,scatter:D}=c().seriesTypes;function j(t,e,o){let i=t.options;return{xPad:-((i.colsize||1)/e),yPad:-((i.rowsize||1)/o)}}let z={hexagon:{alignDataLabel:D.prototype.alignDataLabel,getSeriesPadding:function(t){return j(t,3,2)},haloPath:function(t){if(!t)return[];let e=this.tileEdges;return[["M",e.x2-t,e.y1+t],["L",e.x3+t,e.y1+t],["L",e.x4+1.5*t,e.y2],["L",e.x3+t,e.y3-t],["L",e.x2-t,e.y3-t],["L",e.x1-1.5*t,e.y2],["Z"]]},translate:function(){let t,e=this.options,o=this.xAxis,i=this.yAxis,r=e.pointPadding||0,n=(e.colsize||1)/3,s=(e.rowsize||1)/2;for(let e of(this.generatePoints(),this.points)){let a=x(Math.floor(o.len-o.translate(e.x-2*n,0,1,0,1)),-o.len,2*o.len),l=x(Math.floor(o.len-o.translate(e.x-n,0,1,0,1)),-o.len,2*o.len),h=x(Math.floor(o.len-o.translate(e.x+n,0,1,0,1)),-o.len,2*o.len),p=x(Math.floor(o.len-o.translate(e.x+2*n,0,1,0,1)),-o.len,2*o.len),c=x(Math.floor(i.translate(e.y-s,0,1,0,1)),-i.len,2*i.len),d=x(Math.floor(i.translate(e.y,0,1,0,1)),-i.len,2*i.len),u=x(Math.floor(i.translate(e.y+s,0,1,0,1)),-i.len,2*i.len),f=e.pointPadding??r,y=f*Math.abs(l-a)/Math.abs(u-d),g=o.reversed?-y:y,b=o.reversed?-f:f,m=i.reversed?-f:f;e.x%2&&(t=t||Math.round(Math.abs(u-c)/2)*(i.reversed?-1:1),c+=t,d+=t,u+=t),e.plotX=e.clientX=(l+h)/2,e.plotY=d,e.tileEdges={x1:a+=g+b,x2:l+=b,x3:h-=b,x4:p-=g+b,y1:c-=m,y2:d,y3:u+=m},e.shapeType="path",e.shapeArgs={d:[["M",l,c],["L",h,c],["L",p,d],["L",h,u],["L",l,u],["L",a,d],["Z"]]}}this.translateColors()}},diamond:{alignDataLabel:D.prototype.alignDataLabel,getSeriesPadding:function(t){return j(t,2,2)},haloPath:function(t){if(!t)return[];let e=this.tileEdges;return[["M",e.x2,e.y1+t],["L",e.x3+t,e.y2],["L",e.x2,e.y3-t],["L",e.x1-t,e.y2],["Z"]]},translate:function(){let t,e=this.options,o=this.xAxis,i=this.yAxis,r=e.pointPadding||0,n=e.colsize||1,s=(e.rowsize||1)/2;for(let e of(this.generatePoints(),this.points)){let a=x(Math.round(o.len-o.translate(e.x-n,0,1,0,0)),-o.len,2*o.len),l=x(Math.round(o.len-o.translate(e.x+n,0,1,0,0)),-o.len,2*o.len),h=x(Math.round(i.translate(e.y-s,0,1,0,0)),-i.len,2*i.len),p=x(Math.round(i.translate(e.y,0,1,0,0)),-i.len,2*i.len),c=x(Math.round(i.translate(e.y+s,0,1,0,0)),-i.len,2*i.len),d=x(Math.round(o.len-o.translate(e.x,0,1,0,0)),-o.len,2*o.len),u=L(e.pointPadding,r),f=u*Math.abs(d-a)/Math.abs(c-p),y=o.reversed?-f:f,g=i.reversed?-u:u;e.x%2&&(t=Math.abs(c-h)/2*(i.reversed?-1:1),h+=t,p+=t,c+=t),e.plotX=e.clientX=d,e.plotY=p,e.tileEdges={x1:a+=y,x2:d,x3:l-=y,y1:h-=g,y2:p,y3:c+=g},e.shapeType="path",e.shapeArgs={d:[["M",d,h],["L",l,p],["L",d,c],["L",a,p],["Z"]]}}this.translateColors()}},circle:{alignDataLabel:D.prototype.alignDataLabel,getSeriesPadding:function(t){return j(t,2,2)},haloPath:function(t){return D.prototype.pointClass.prototype.haloPath.call(this,t+(t&&this.radius))},translate:function(){let t=this.options,e=this.xAxis,o=this.yAxis,i=t.pointPadding||0,r=(t.rowsize||1)/2,n=t.colsize||1,s,a,l,h,p=!1;for(let t of(this.generatePoints(),this.points)){let c=x(Math.round(e.len-e.translate(t.x,0,1,0,0)),-e.len,2*e.len),d=i,u=!1,f=x(Math.round(o.translate(t.y,0,1,0,0)),-o.len,2*o.len);void 0!==t.pointPadding&&(d=t.pointPadding,u=!0,p=!0),(!h||p)&&(l=Math.floor(Math.sqrt((s=Math.abs(x(Math.floor(e.len-e.translate(t.x+n,0,1,0,0)),-e.len,2*e.len)-c))*s+(a=Math.abs(x(Math.floor(o.translate(t.y+r,0,1,0,0)),-o.len,2*o.len)-f))*a)/2),h=Math.min(s,l,a)-d,p&&!u&&(p=!1)),t.x%2&&(f+=a*(o.reversed?-1:1)),t.plotX=t.clientX=c,t.plotY=f,t.radius=h,t.shapeType="circle",t.shapeArgs={x:c,y:f,r:h}}this.translateColors()}},square:{alignDataLabel:I.prototype.alignDataLabel,translate:I.prototype.translate,getSeriesPadding:O,haloPath:I.prototype.pointClass.prototype.haloPath}},{composed:_,noop:H}=h(),{column:X,heatmap:k,scatter:F}=c().seriesTypes;function R(){if(this.recomputingForTilemap||"colorAxis"===this.coll)return;let t=this,e=t.series.map(function(e){return e.getSeriesPixelPadding&&e.getSeriesPixelPadding(t)}).reduce(function(t,e){return(t&&t.padding)>(e&&e.padding)?t:e},void 0)||{padding:0,axisLengthFactor:1},o=Math.round(e.padding*e.axisLengthFactor);e.padding&&(t.len-=o,t.recomputingForTilemap=!0,t.setAxisTranslation(),delete t.recomputingForTilemap,t.minPixelPadding+=e.padding,t.len+=o)}class V extends k{static compose(t){0>_.indexOf("TilemapSeries")&&_.push("TilemapSeries")&&g(t,"afterSetAxisTranslation",R)}alignDataLabel(){return this.tileShape.alignDataLabel.apply(this,arguments)}drawPoints(){for(let t of(X.prototype.drawPoints.call(this),this.points))t.graphic&&t.graphic[this.chart.styledMode?"css":"animate"](this.colorAttribs(t))}getSeriesPixelPadding(t){let e=t.isXAxis,o=this.tileShape.getSeriesPadding(this);if(!o)return{padding:0,axisLengthFactor:1};let i=Math.round(t.translate(e?2*o.xPad:o.yPad,0,1,0,1)),r=Math.round(t.translate(e?o.xPad:0,0,1,0,1));return{padding:(t.single?Math.abs(i-r)/2:Math.abs(i-r))||0,axisLengthFactor:e?2:1.1}}setOptions(){let t=super.setOptions.apply(this,arguments);return this.tileShape=z[t.tileShape],t}translate(){return this.tileShape.translate.apply(this,arguments)}}V.defaultOptions=v(k.defaultOptions,{marker:null,states:{hover:{halo:{enabled:!0,size:2,opacity:.5,attributes:{zIndex:3}}}},pointPadding:2,tileShape:"hexagon"}),b(V.prototype,{getSymbol:H,markerAttribs:F.prototype.markerAttribs,pointAttribs:X.prototype.pointAttribs,pointClass:E}),c().registerSeriesType("tilemap",V);let Z=h();V.compose(Z.Axis);let N=h();return a.default})());