/* Highcharts JS v7.0.3 (2019-02-06) Tilemap module (c) 2010-2019 Highsoft AS License: www.highcharts.com/license */ (function(g){"object"===typeof module&&module.exports?(g["default"]=g,module.exports=g):"function"===typeof define&&define.amd?define(function(){return g}):g("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(g){(function(d){var g=d.defined,v=d.noop,f=d.seriesTypes;d.colorPointMixin={isValid:function(){return null!==this.value&&Infinity!==this.value&&-Infinity!==this.value},setVisible:function(d){var a=this,b=d?"show":"hide";a.visible=!!d;["graphic","dataLabel"].forEach(function(c){if(a[c])a[c][b]()})}, setState:function(f){d.Point.prototype.setState.call(this,f);this.graphic&&this.graphic.attr({zIndex:"hover"===f?1:0})}};d.colorSeriesMixin={pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],optionalAxis:"colorAxis",trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:v,parallelArrays:["x","y","value"],colorKey:"value",pointAttribs:f.column.prototype.pointAttribs,translateColors:function(){var d=this,a=this.options.nullColor,b=this.colorAxis,c=this.colorKey;this.data.forEach(function(e){var m= e[c];if(m=e.options.color||(e.isNull?a:b&&void 0!==m?b.toColor(m,e):e.color||d.color))e.color=m})},colorAttribs:function(d){var a={};g(d.color)&&(a[this.colorProp||"fill"]=d.color);return a}}})(g);(function(d){var g=d.colorPointMixin,v=d.merge,f=d.noop,r=d.pick,a=d.Series,b=d.seriesType,c=d.seriesTypes;b("heatmap","scatter",{animation:!1,borderWidth:0,nullColor:"#f7f7f7",dataLabels:{formatter:function(){return this.point.value},inside:!0,verticalAlign:"middle",crop:!1,overflow:!1,padding:0},marker:null, pointRange:null,tooltip:{pointFormat:"{point.x}, {point.y}: {point.value}\x3cbr/\x3e"},states:{hover:{halo:!1,brightness:.2}}},v(d.colorSeriesMixin,{pointArrayMap:["y","value"],hasPointSpecificOptions:!0,getExtremesFromAll:!0,directTouch:!0,init:function(){var b;c.scatter.prototype.init.apply(this,arguments);b=this.options;b.pointRange=r(b.pointRange,b.colsize||1);this.yAxis.axisPointRange=b.rowsize||1},translate:function(){var b=this.options,a=this.xAxis,c=this.yAxis,d=b.pointPadding||0,h=function(b, a,c){return Math.min(Math.max(a,b),c)},f=this.pointPlacementToXValue();this.generatePoints();this.points.forEach(function(e){var m=(b.colsize||1)/2,q=(b.rowsize||1)/2,n=h(Math.round(a.len-a.translate(e.x-m,0,1,0,1,-f)),-a.len,2*a.len),m=h(Math.round(a.len-a.translate(e.x+m,0,1,0,1,-f)),-a.len,2*a.len),k=h(Math.round(c.translate(e.y-q,0,1,0,1)),-c.len,2*c.len),q=h(Math.round(c.translate(e.y+q,0,1,0,1)),-c.len,2*c.len),l=r(e.pointPadding,d);e.plotX=e.clientX=(n+m)/2;e.plotY=(k+q)/2;e.shapeType="rect"; e.shapeArgs={x:Math.min(n,m)+l,y:Math.min(k,q)+l,width:Math.abs(m-n)-2*l,height:Math.abs(q-k)-2*l}});this.translateColors()},drawPoints:function(){var b=this.chart.styledMode?"css":"attr";c.column.prototype.drawPoints.call(this);this.points.forEach(function(a){a.graphic[b](this.colorAttribs(a))},this)},getValidPoints:function(b,c){return a.prototype.getValidPoints.call(this,b,c,!0)},animate:f,getBox:f,drawLegendSymbol:d.LegendSymbolMixin.drawRectangle,alignDataLabel:c.column.prototype.alignDataLabel, getExtremes:function(){a.prototype.getExtremes.call(this,this.valueData);this.valueMin=this.dataMin;this.valueMax=this.dataMax;a.prototype.getExtremes.call(this)}}),d.extend({haloPath:function(b){if(!b)return[];var a=this.shapeArgs;return["M",a.x-b,a.y-b,"L",a.x-b,a.y+a.height+b,a.x+a.width+b,a.y+a.height+b,a.x+a.width+b,a.y-b,"Z"]}},g))})(g);(function(d){var g=d.seriesType,v=d.pick,f=function(a,b,c){return Math.min(Math.max(b,a),c)},r=function(a,b,c){a=a.options;return{xPad:(a.colsize||1)/-b,yPad:(a.rowsize|| 1)/-c}};d.tileShapeTypes={hexagon:{alignDataLabel:d.seriesTypes.scatter.prototype.alignDataLabel,getSeriesPadding:function(a){return r(a,3,2)},haloPath:function(a){if(!a)return[];var b=this.tileEdges;return["M",b.x2-a,b.y1+a,"L",b.x3+a,b.y1+a,b.x4+1.5*a,b.y2,b.x3+a,b.y3-a,b.x2-a,b.y3-a,b.x1-1.5*a,b.y2,"Z"]},translate:function(){var a=this.options,b=this.xAxis,c=this.yAxis,d=a.pointPadding||0,m=(a.colsize||1)/3,g=(a.rowsize||1)/2,t;this.generatePoints();this.points.forEach(function(a){var e=f(Math.floor(b.len- b.translate(a.x-2*m,0,1,0,1)),-b.len,2*b.len),h=f(Math.floor(b.len-b.translate(a.x-m,0,1,0,1)),-b.len,2*b.len),u=f(Math.floor(b.len-b.translate(a.x+m,0,1,0,1)),-b.len,2*b.len),q=f(Math.floor(b.len-b.translate(a.x+2*m,0,1,0,1)),-b.len,2*b.len),n=f(Math.floor(c.translate(a.y-g,0,1,0,1)),-c.len,2*c.len),k=f(Math.floor(c.translate(a.y,0,1,0,1)),-c.len,2*c.len),l=f(Math.floor(c.translate(a.y+g,0,1,0,1)),-c.len,2*c.len),p=v(a.pointPadding,d),r=p*Math.abs(h-e)/Math.abs(l-k),r=b.reversed?-r:r,w=b.reversed? -p:p,p=c.reversed?-p:p;a.x%2&&(t=t||Math.round(Math.abs(l-n)/2)*(c.reversed?-1:1),n+=t,k+=t,l+=t);a.plotX=a.clientX=(h+u)/2;a.plotY=k;e+=r+w;h+=w;u-=w;q-=r+w;n-=p;l+=p;a.tileEdges={x1:e,x2:h,x3:u,x4:q,y1:n,y2:k,y3:l};a.shapeType="path";a.shapeArgs={d:["M",h,n,"L",u,n,q,k,u,l,h,l,e,k,"Z"]}});this.translateColors()}},diamond:{alignDataLabel:d.seriesTypes.scatter.prototype.alignDataLabel,getSeriesPadding:function(a){return r(a,2,2)},haloPath:function(a){if(!a)return[];var b=this.tileEdges;return["M", b.x2,b.y1+a,"L",b.x3+a,b.y2,b.x2,b.y3-a,b.x1-a,b.y2,"Z"]},translate:function(){var a=this.options,b=this.xAxis,c=this.yAxis,d=a.pointPadding||0,m=a.colsize||1,g=(a.rowsize||1)/2,t;this.generatePoints();this.points.forEach(function(a){var e=f(Math.round(b.len-b.translate(a.x-m,0,1,0,0)),-b.len,2*b.len),h=f(Math.round(b.len-b.translate(a.x,0,1,0,0)),-b.len,2*b.len),u=f(Math.round(b.len-b.translate(a.x+m,0,1,0,0)),-b.len,2*b.len),q=f(Math.round(c.translate(a.y-g,0,1,0,0)),-c.len,2*c.len),n=f(Math.round(c.translate(a.y, 0,1,0,0)),-c.len,2*c.len),k=f(Math.round(c.translate(a.y+g,0,1,0,0)),-c.len,2*c.len),l=v(a.pointPadding,d),p=l*Math.abs(h-e)/Math.abs(k-n),p=b.reversed?-p:p,l=c.reversed?-l:l;a.x%2&&(t=Math.abs(k-q)/2*(c.reversed?-1:1),q+=t,n+=t,k+=t);a.plotX=a.clientX=h;a.plotY=n;e+=p;u-=p;q-=l;k+=l;a.tileEdges={x1:e,x2:h,x3:u,y1:q,y2:n,y3:k};a.shapeType="path";a.shapeArgs={d:["M",h,q,"L",u,n,h,k,e,n,"Z"]}});this.translateColors()}},circle:{alignDataLabel:d.seriesTypes.scatter.prototype.alignDataLabel,getSeriesPadding:function(a){return r(a, 2,2)},haloPath:function(a){return d.seriesTypes.scatter.prototype.pointClass.prototype.haloPath.call(this,a+(a&&this.radius))},translate:function(){var a=this.options,b=this.xAxis,c=this.yAxis,d=a.pointPadding||0,m=(a.rowsize||1)/2,g=a.colsize||1,t,h,r,v,u=!1;this.generatePoints();this.points.forEach(function(a){var e=f(Math.round(b.len-b.translate(a.x,0,1,0,0)),-b.len,2*b.len),k=f(Math.round(c.translate(a.y,0,1,0,0)),-c.len,2*c.len),l=d,p=!1;void 0!==a.pointPadding&&(l=a.pointPadding,u=p=!0);if(!v|| u)t=Math.abs(f(Math.floor(b.len-b.translate(a.x+g,0,1,0,0)),-b.len,2*b.len)-e),h=Math.abs(f(Math.floor(c.translate(a.y+m,0,1,0,0)),-c.len,2*c.len)-k),r=Math.floor(Math.sqrt(t*t+h*h)/2),v=Math.min(t,r,h)-l,u&&!p&&(u=!1);a.x%2&&(k+=h*(c.reversed?-1:1));a.plotX=a.clientX=e;a.plotY=k;a.radius=v;a.shapeType="circle";a.shapeArgs={x:e,y:k,r:v}});this.translateColors()}},square:{alignDataLabel:d.seriesTypes.heatmap.prototype.alignDataLabel,translate:d.seriesTypes.heatmap.prototype.translate,getSeriesPadding:function(){}, haloPath:d.seriesTypes.heatmap.prototype.pointClass.prototype.haloPath}};d.addEvent(d.Axis,"afterSetAxisTranslation",function(){if(!this.recomputingForTilemap){var a=this,b=a.series.map(function(b){return b.getSeriesPixelPadding&&b.getSeriesPixelPadding(a)}).reduce(function(a,b){return(a&&a.padding)>(b&&b.padding)?a:b},void 0)||{padding:0,axisLengthFactor:1},c=Math.round(b.padding*b.axisLengthFactor);b.padding&&(a.len-=c,a.recomputingForTilemap=!0,a.setAxisTranslation(),delete a.recomputingForTilemap, a.minPixelPadding+=b.padding,a.len+=c)}});g("tilemap","heatmap",{states:{hover:{halo:{enabled:!0,size:2,opacity:.5,attributes:{zIndex:3}}}},pointPadding:2,tileShape:"hexagon"},{setOptions:function(){var a=d.seriesTypes.heatmap.prototype.setOptions.apply(this,Array.prototype.slice.call(arguments));this.tileShape=d.tileShapeTypes[a.tileShape];return a},alignDataLabel:function(){return this.tileShape.alignDataLabel.apply(this,Array.prototype.slice.call(arguments))},getSeriesPixelPadding:function(a){var b= a.isXAxis,c=this.tileShape.getSeriesPadding(this),d;if(!c)return{padding:0,axisLengthFactor:1};d=Math.round(a.translate(b?2*c.xPad:c.yPad,0,1,0,1));a=Math.round(a.translate(b?c.xPad:0,0,1,0,1));return{padding:Math.abs(d-a)||0,axisLengthFactor:b?2:1.1}},translate:function(){return this.tileShape.translate.apply(this,Array.prototype.slice.call(arguments))}},d.extend({haloPath:function(){return this.series.tileShape.haloPath.apply(this,Array.prototype.slice.call(arguments))}},d.colorPointMixin))})(g)}); //# sourceMappingURL=tilemap.js.map