UNPKG

highcharts

Version:
13 lines 10.2 kB
!/** * Highmaps JS v13.0.1 (2026-08-17) * @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,i)=>(()=>{"use strict";var a,s={620(t){t.exports=i},512(t){t.exports=e},944(e){e.exports=t}};let o={};function r(t){let e=o[t];if(void 0!==e)return e.exports;let i=o[t]={exports:{}};return s[t](i,i.exports,r),i.exports}r.n=t=>{let e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{if(Array.isArray(e))for(var i=0;i<e.length;){var a=e[i++],s=e[i++];r.o(t,a)?0===s&&i++:0===s?Object.defineProperty(t,a,{enumerable:!0,value:e[i++]}):Object.defineProperty(t,a,{enumerable:!0,get:s})}else for(var a in e)r.o(e,a)&&!r.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let n={};r.d(n,{default:()=>I});var l=r(944),p=r.n(l),h=r(512),d=r.n(h),c=r(620);let{parse:u}=r.n(c)();!function(t){let e;function i(){let{userOptions:t}=this;this.colorAxis=[],t.colorAxis&&(t.colorAxis=(0,l.splat)(t.colorAxis),t.colorAxis.map(t=>new e(this,t)))}function a(t){let e=this.chart.colorAxis||[],i=e=>{let i=t.allItems.indexOf(e);-1!==i&&(this.destroyItem(t.allItems[i]),t.allItems.splice(i,1))},a=[],s,o;for(e.forEach(function(t){s=t.options,s?.showInLegend&&(s.dataClasses&&s.visible?a=a.concat(t.getDataClassLegendSymbols()):s.visible&&a.push(t),t.series.forEach(function(t){(!t.options.showInLegend||s.dataClasses)&&("point"===t.options.legendType?t.points.forEach(function(t){i(t)}):i(t))}))}),o=a.length;o--;)t.allItems.unshift(a[o])}function s(t){t.visible&&t.item.legendColor&&t.item.legendItem.symbol.attr({fill:t.item.legendColor})}function o(t){this.chart.colorAxis?.forEach(e=>{e.update({},t.redraw)})}function r(){(this.chart.colorAxis?.length||this.colorAttribs)&&this.translateColors()}function n(){let t=this.axisTypes;t?-1===t.indexOf("colorAxis")&&t.push("colorAxis"):this.axisTypes=["colorAxis"]}function p(t){let e=this,i=t?"show":"hide";e.visible=e.options.visible=!!t,["graphic","dataLabel"].forEach(function(t){e[t]&&e[t][i]()}),this.series.buildKDTree()}function h(){let t=this,e=this.getPointsCollection(),i=this.options.nullColor,a=this.colorAxis,s=this.colorKey;e.forEach(e=>{let o=e.getNestedProperty(s),r=e.options.color||(e.isNull||null===e.value?i:a&&void 0!==o?a.toColor(o,e):e.color||t.color);r&&e.color!==r&&(e.color=r,"point"===t.options.legendType&&e.legendItem&&e.legendItem.label&&t.chart.legend.colorizeItem(e,e.visible))})}function d(){this.elem.attr("fill",u(this.start).tweenTo(u(this.end),this.pos),void 0,!0)}function c(){this.elem.attr("stroke",u(this.start).tweenTo(u(this.end),this.pos),void 0,!0)}t.compose=function(t,u,g,x,f){var y;let m,b=u.prototype,A=g.prototype,P=f.prototype;b.collectionsWithUpdate.includes("colorAxis")||(e=t,b.collectionsWithUpdate.push("colorAxis"),b.collectionsWithInit.colorAxis=[b.addColorAxis],(0,l.addEvent)(u,"afterCreateAxes",i),m=(y=u).prototype.createAxis,y.prototype.createAxis=function(t,i){if("colorAxis"!==t)return m.apply(this,arguments);let a=new e(this,(0,l.merge)(i.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}),(0,l.pick)(i.redraw,!0)&&this.redraw(i.animation),a},A.fillSetter=d,A.strokeSetter=c,(0,l.addEvent)(x,"afterGetAllItems",a),(0,l.addEvent)(x,"afterColorizeItem",s),(0,l.addEvent)(x,"afterUpdate",o),(0,l.extend)(P,{optionalAxis:"colorAxis",translateColors:h}),(0,l.extend)(P.pointClass.prototype,{setVisible:p}),(0,l.addEvent)(f,"afterTranslate",r,{order:1}),(0,l.addEvent)(f,"bindAxes",n))},t.pointSetVisible=p}(a||(a={}));let g=a,{series:{prototype:{pointClass:x}},seriesTypes:{heatmap:{prototype:{pointClass:f}}}}=d();class y extends f{haloPath(){return this.series.tileShape.haloPath.apply(this,arguments)}}(0,l.extend)(y.prototype,{setState:x.prototype.setState,setVisible:g.pointSetVisible});let{noop:m}=p(),{heatmap:b,scatter:A}=d().seriesTypes;function P(t,e,i){let a=t.options;return{xPad:-((a.colsize||1)/e),yPad:-((a.rowsize||1)/i)}}let M={hexagon:{alignDataLabel:A.prototype.alignDataLabel,getSeriesPadding:function(t){return P(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,i=this.xAxis,a=this.yAxis,s=e.pointPadding||0,o=(e.colsize||1)/3,r=(e.rowsize||1)/2;for(let e of(this.generatePoints(),this.points)){let n=(0,l.clamp)(Math.floor(i.len-i.translate(e.x-2*o,0,1,0,1)),-i.len,2*i.len),p=(0,l.clamp)(Math.floor(i.len-i.translate(e.x-o,0,1,0,1)),-i.len,2*i.len),h=(0,l.clamp)(Math.floor(i.len-i.translate(e.x+o,0,1,0,1)),-i.len,2*i.len),d=(0,l.clamp)(Math.floor(i.len-i.translate(e.x+2*o,0,1,0,1)),-i.len,2*i.len),c=(0,l.clamp)(Math.floor(a.translate(e.y-r,0,1,0,1)),-a.len,2*a.len),u=(0,l.clamp)(Math.floor(a.translate(e.y,0,1,0,1)),-a.len,2*a.len),g=(0,l.clamp)(Math.floor(a.translate(e.y+r,0,1,0,1)),-a.len,2*a.len),x=e.pointPadding??s,f=x*Math.abs(p-n)/Math.abs(g-u),y=i.reversed?-f:f,m=i.reversed?-x:x,b=a.reversed?-x:x;e.x%2&&(t=t||Math.round(Math.abs(g-c)/2)*(a.reversed?-1:1),c+=t,u+=t,g+=t),e.plotX=e.clientX=(p+h)/2,e.plotY=u,e.tileEdges={x1:n+=y+m,x2:p+=m,x3:h-=m,x4:d-=y+m,y1:c-=b,y2:u,y3:g+=b},e.shapeType="path",e.shapeArgs={d:[["M",p,c],["L",h,c],["L",d,u],["L",h,g],["L",p,g],["L",n,u],["Z"]]}}this.translateColors()}},diamond:{alignDataLabel:A.prototype.alignDataLabel,getSeriesPadding:function(t){return P(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,i=this.xAxis,a=this.yAxis,s=e.pointPadding||0,o=e.colsize||1,r=(e.rowsize||1)/2;for(let e of(this.generatePoints(),this.points)){let n=(0,l.clamp)(Math.round(i.len-i.translate(e.x-o,0,1,0,0)),-i.len,2*i.len),p=(0,l.clamp)(Math.round(i.len-i.translate(e.x+o,0,1,0,0)),-i.len,2*i.len),h=(0,l.clamp)(Math.round(a.translate(e.y-r,0,1,0,0)),-a.len,2*a.len),d=(0,l.clamp)(Math.round(a.translate(e.y,0,1,0,0)),-a.len,2*a.len),c=(0,l.clamp)(Math.round(a.translate(e.y+r,0,1,0,0)),-a.len,2*a.len),u=(0,l.clamp)(Math.round(i.len-i.translate(e.x,0,1,0,0)),-i.len,2*i.len),g=(0,l.pick)(e.pointPadding,s),x=g*Math.abs(u-n)/Math.abs(c-d),f=i.reversed?-x:x,y=a.reversed?-g:g;e.x%2&&(t=Math.abs(c-h)/2*(a.reversed?-1:1),h+=t,d+=t,c+=t),e.plotX=e.clientX=u,e.plotY=d,e.tileEdges={x1:n+=f,x2:u,x3:p-=f,y1:h-=y,y2:d,y3:c+=y},e.shapeType="path",e.shapeArgs={d:[["M",u,h],["L",p,d],["L",u,c],["L",n,d],["Z"]]}}this.translateColors()}},circle:{alignDataLabel:A.prototype.alignDataLabel,getSeriesPadding:function(t){return P(t,2,2)},haloPath:function(t){return A.prototype.pointClass.prototype.haloPath.call(this,t+(t&&this.radius))},translate:function(){let t=this.options,e=this.xAxis,i=this.yAxis,a=t.pointPadding||0,s=(t.rowsize||1)/2,o=t.colsize||1,r,n,p,h,d=!1;for(let t of(this.generatePoints(),this.points)){let c=(0,l.clamp)(Math.round(e.len-e.translate(t.x,0,1,0,0)),-e.len,2*e.len),u=a,g=!1,x=(0,l.clamp)(Math.round(i.translate(t.y,0,1,0,0)),-i.len,2*i.len);void 0!==t.pointPadding&&(u=t.pointPadding,g=!0,d=!0),(!h||d)&&(p=Math.floor(Math.sqrt((r=Math.abs((0,l.clamp)(Math.floor(e.len-e.translate(t.x+o,0,1,0,0)),-e.len,2*e.len)-c))*r+(n=Math.abs((0,l.clamp)(Math.floor(i.translate(t.y+s,0,1,0,0)),-i.len,2*i.len)-x))*n)/2),h=Math.min(r,p,n)-u,d&&!g&&(d=!1)),t.x%2&&(x+=n*(i.reversed?-1:1)),t.plotX=t.clientX=c,t.plotY=x,t.radius=h,t.shapeType="circle",t.shapeArgs={x:c,y:x,r:h}}this.translateColors()}},square:{alignDataLabel:b.prototype.alignDataLabel,translate:b.prototype.translate,getSeriesPadding:m,haloPath:b.prototype.pointClass.prototype.haloPath}},{composed:v,noop:L}=p(),{column:S,heatmap:C,scatter:w}=d().seriesTypes;function T(){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},i=Math.round(e.padding*e.axisLengthFactor);e.padding&&(t.len-=i,t.recomputingForTilemap=!0,t.setAxisTranslation(),delete t.recomputingForTilemap,t.minPixelPadding+=e.padding,t.len+=i)}class E extends C{static compose(t){(0,l.pushUnique)(v,"TilemapSeries")&&(0,l.addEvent)(t,"afterSetAxisTranslation",T)}alignDataLabel(){return this.tileShape.alignDataLabel.apply(this,arguments)}drawPoints(){for(let t of(S.prototype.drawPoints.call(this),this.points))t.graphic&&t.graphic[this.chart.styledMode?"css":"animate"](this.colorAttribs(t))}getSeriesPixelPadding(t){let e=t.isXAxis,i=this.tileShape.getSeriesPadding(this);if(!i)return{padding:0,axisLengthFactor:1};let a=Math.round(t.translate(e?2*i.xPad:i.yPad,0,1,0,1)),s=Math.round(t.translate(e?i.xPad:0,0,1,0,1));return{padding:(t.single?Math.abs(a-s)/2:Math.abs(a-s))||0,axisLengthFactor:e?2:1.1}}setOptions(){let t=super.setOptions.apply(this,arguments);return this.tileShape=M[t.tileShape],t}translate(){return this.tileShape.translate.apply(this,arguments)}}E.defaultOptions=(0,l.merge)(C.defaultOptions,{marker:null,states:{hover:{halo:{enabled:!0,size:2,opacity:.5,attributes:{zIndex:3}}}},pointPadding:2,tileShape:"hexagon"}),(0,l.extend)(E.prototype,{getSymbol:L,markerAttribs:w.prototype.markerAttribs,pointAttribs:S.prototype.pointAttribs,pointClass:y}),d().registerSeriesType("tilemap",E);let D=p();E.compose(D.Axis);let I=p();return n.default})());