;!function(t){function o(t,o,e){for(var i=4,a=[];i--;)a[i]=Math.round(o.rgba[i]+(t.rgba[i]-o.rgba[i])*(1-e));return"rgba("+a.join(",")+")"}var e=t.Axis,i=t.Chart,a=t.Point,n=t.Pointer,r=t.each,s=t.extend,l=t.merge,h=t.pick,p=t.numberFormat,d=t.getOptions(),m=t.seriesTypes,c=d.plotOptions,u=t.wrap,x=t.Color,g=function(){};d.mapNavigation={buttonOptions:{align:"right",verticalAlign:"bottom",x:0,width:18,height:18,style:{fontSize:"15px",fontWeight:"bold",textAlign:"center"}},buttons:{zoomIn:{onclick:function(){this.mapZoom(.5)},text:"+",y:-32},zoomOut:{onclick:function(){this.mapZoom(2)},text:"-",y:0}}},t.splitPath=function(t){var o,t=t.replace(/([A-Za-z])/g," $1 "),t=t.replace(/^\s*/,"").replace(/\s*$/,""),t=t.split(/[ ,]+/);for(o=0;o<t.length;o++)/[a-zA-Z]/.test(t[o])||(t[o]=parseFloat(t[o]));return t},t.maps={},u(e.prototype,"getSeriesExtremes",function(t){var o,e,i=this.isXAxis,a=[];r(this.series,function(t,o){t.useMapGeometry&&(a[o]=t.xData,t.xData=[])}),t.call(this),o=h(this.dataMin,Number.MAX_VALUE),e=h(this.dataMax,Number.MIN_VALUE),r(this.series,function(t,n){t.useMapGeometry&&(o=Math.min(o,t[i?"minX":"minY"]),e=Math.max(e,t[i?"maxX":"maxY"]),t.xData=a[n])}),this.dataMin=o,this.dataMax=e}),u(e.prototype,"setAxisTranslation",function(t){var o=this.chart,e=o.plotWidth/o.plotHeight,i=this.isXAxis,a=o.xAxis[0];t.call(this),"map"!==o.options.chart.type||i||void 0===a.transA||(this.transA=a.transA=Math.min(this.transA,a.transA),t=(a.max-a.min)/(this.max-this.min),a=t>e?this:a,e=(a.max-a.min)*a.transA,a.minPixelPadding=(a.len-e)/2)}),u(i.prototype,"render",function(o){var e=this,i=e.options.mapNavigation;o.call(e),e.renderMapNavigation(),i.zoomOnDoubleClick&&t.addEvent(e.container,"dblclick",function(t){e.pointer.onContainerDblClick(t)}),i.zoomOnMouseWheel&&t.addEvent(e.container,void 0===document.onmousewheel?"DOMMouseScroll":"mousewheel",function(t){e.pointer.onContainerMouseWheel(t)})}),s(n.prototype,{onContainerDblClick:function(t){var o=this.chart,t=this.normalize(t);o.isInsidePlot(t.chartX-o.plotLeft,t.chartY-o.plotTop)&&o.mapZoom(.5,o.xAxis[0].toValue(t.chartX),o.yAxis[0].toValue(t.chartY))},onContainerMouseWheel:function(t){var o,e=this.chart,t=this.normalize(t);o=t.detail||-(t.wheelDelta/120),e.isInsidePlot(t.chartX-e.plotLeft,t.chartY-e.plotTop)&&e.mapZoom(o>0?2:.5,e.xAxis[0].toValue(t.chartX),e.yAxis[0].toValue(t.chartY))}}),u(n.prototype,"init",function(t,o,e){t.call(this,o,e),e.mapNavigation.enableTouchZoom&&(this.pinchX=this.pinchHor=this.pinchY=this.pinchVert=!0)}),s(i.prototype,{renderMapNavigation:function(){var t,o,e,i=this,a=this.options.mapNavigation,n=a.buttons,r=function(){this.handler.call(i)};if(a.enableButtons)for(t in n)n.hasOwnProperty(t)&&(e=l(a.buttonOptions,n[t]),o=i.renderer.button(e.text,0,0,r).attr({width:e.width,height:e.height}).css(e.style).add(),o.handler=e.onclick,o.align(s(e,{width:o.width,height:o.height}),null,"spacingBox"))},fitToBox:function(t,o){return r([["x","width"],["y","height"]],function(e){var i=e[0],e=e[1];t[i]+t[e]>o[i]+o[e]&&(t[e]>o[e]?(t[e]=o[e],t[i]=o[i]):t[i]=o[i]+o[e]-t[e]),t[e]>o[e]&&(t[e]=o[e]),t[i]<o[i]&&(t[i]=o[i])}),t},mapZoom:function(t,o,e){if(!this.isMapZooming){var i=this,a=i.xAxis[0],n=a.max-a.min,r=h(o,a.min+n/2),o=n*t,n=i.yAxis[0],s=n.max-n.min,e=h(e,n.min+s/2);t*=s,r-=o/2,s=e-t/2,e=h(i.options.chart.animation,!0),o=i.fitToBox({x:r,y:s,width:o,height:t},{x:a.dataMin,y:n.dataMin,width:a.dataMax-a.dataMin,height:n.dataMax-n.dataMin}),a.setExtremes(o.x,o.x+o.width,!1),n.setExtremes(o.y,o.y+o.height,!1),(a=e?e.duration||500:0)&&(i.isMapZooming=!0,setTimeout(function(){i.isMapZooming=!1},a)),i.redraw()}}}),c.map=l(c.scatter,{animation:!1,nullColor:"#F8F8F8",borderColor:"silver",borderWidth:1,marker:null,stickyTracking:!1,dataLabels:{verticalAlign:"middle"},turboThreshold:0,tooltip:{followPointer:!0,pointFormat:"{point.name}: {point.y}<br/>"},states:{normal:{animation:!0}}}),e=t.extendClass(a,{applyOptions:function(o,e){var i=a.prototype.applyOptions.call(this,o,e);return i.path&&"string"==typeof i.path&&(i.path=i.options.path=t.splitPath(i.path)),i},onMouseOver:function(){clearTimeout(this.colorInterval),a.prototype.onMouseOver.call(this)},onMouseOut:function(){var t=this,e=+new Date,i=x(t.options.color),n=x(t.pointAttr.hover.fill),r=t.series.options.states.normal.animation,s=r&&(r.duration||500);s&&4===i.rgba.length&&4===n.rgba.length&&(delete t.pointAttr[""].fill,clearTimeout(t.colorInterval),t.colorInterval=setInterval(function(){var a=(new Date-e)/s,r=t.graphic;a>1&&(a=1),r&&r.attr("fill",o(n,i,a)),a>=1&&clearTimeout(t.colorInterval)},13)),a.prototype.onMouseOut.call(t)}}),m.map=t.extendClass(m.scatter,{type:"map",pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},colorKey:"y",pointClass:e,trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:g,supportsDrilldown:!0,getExtremesFromAll:!0,useMapGeometry:!0,init:function(o){var e,i,a,n,s,l,h,d=this,c=o.options.legend.valueDecimals,u=[];l="horizontal"===o.options.legend.layout,t.Series.prototype.init.apply(this,arguments),s=d.options.colorRange,(n=d.options.valueRanges)?(r(n,function(o){i=o.from,a=o.to,e="",void 0===i?e="< ":void 0===a&&(e="> "),void 0!==i&&(e+=p(i,c)),void 0!==i&&void 0!==a&&(e+=" - "),void 0!==a&&(e+=p(a,c)),u.push(t.extend({chart:d.chart,name:e,options:{},drawLegendSymbol:m.area.prototype.drawLegendSymbol,visible:!0,setState:function(){},setVisible:function(){}},o))}),d.legendItems=u):s&&(i=s.from,a=s.to,n=s.fromLabel,s=s.toLabel,h=l?[0,0,1,0]:[0,1,0,0],l||(l=n,n=s,s=l),l={linearGradient:{x1:h[0],y1:h[1],x2:h[2],y2:h[3]},stops:[[0,i],[1,a]]},u=[{chart:d.chart,options:{},fromLabel:n,toLabel:s,color:l,drawLegendSymbol:this.drawLegendSymbolGradient,visible:!0,setState:function(){},setVisible:function(){}}],d.legendItems=u)},drawLegendSymbol:m.area.prototype.drawLegendSymbol,drawLegendSymbolGradient:function(t,o){var e,i,a,n=t.options.symbolPadding,r=h(t.options.padding,8),s=this.chart.renderer.fontMetrics(t.options.itemStyle.fontSize).h,l="horizontal"===t.options.layout;a=h(t.options.rectangleLength,200),l?(e=-(n/2),i=0):(e=-a+t.baseline-n/2,i=r+s),o.fromText=this.chart.renderer.text(o.fromLabel,i,e).attr({zIndex:2}).add(o.legendGroup),i=o.fromText.getBBox(),o.legendSymbol=this.chart.renderer.rect(l?i.x+i.width+n:i.x-s-n,i.y,l?a:s,l?s:a,2).attr({zIndex:1}).add(o.legendGroup),a=o.legendSymbol.getBBox(),o.toText=this.chart.renderer.text(o.toLabel,a.x+a.width+n,l?e:a.y+a.height-n).attr({zIndex:2}).add(o.legendGroup),e=o.toText.getBBox(),l?(t.offsetWidth=i.width+a.width+e.width+2*n+r,t.itemY=s+r):(t.offsetWidth=Math.max(i.width,e.width)+n+a.width+r,t.itemY=a.height+r,t.itemX=n)},getBox:function(t){var o=Number.MIN_VALUE,e=Number.MAX_VALUE,i=Number.MIN_VALUE,a=Number.MAX_VALUE;r(t||this.options.data,function(t){for(var n=t.path,r=n.length,s=!1,l=Number.MIN_VALUE,h=Number.MAX_VALUE,p=Number.MIN_VALUE,d=Number.MAX_VALUE;r--;)"number"==typeof n[r]&&!isNaN(n[r])&&(s?(l=Math.max(l,n[r]),h=Math.min(h,n[r])):(p=Math.max(p,n[r]),d=Math.min(d,n[r])),s=!s);t._maxX=l,t._minX=h,t._maxY=p,t._minY=d,o=Math.max(o,l),e=Math.min(e,h),i=Math.max(i,p),a=Math.min(a,d)}),this.minY=a,this.maxY=i,this.minX=e,this.maxX=o},translatePath:function(t){var o,e=!1,i=this.xAxis,a=this.yAxis,t=[].concat(t);for(o=t.length;o--;)"number"==typeof t[o]&&(t[o]=e?Math.round(i.translate(t[o])):Math.round(a.len-a.translate(t[o])),e=!e);return t},setData:function(){t.Series.prototype.setData.apply(this,arguments),this.getBox()},translate:function(){var t=this,o=Number.MAX_VALUE,e=Number.MIN_VALUE;t.generatePoints(),r(t.data,function(i){i.shapeType="path",i.shapeArgs={d:t.translatePath(i.path)},"number"==typeof i.y&&(i.y>e?e=i.y:i.y<o&&(o=i.y))}),t.translateColors(o,e)},translateColors:function(t,e){var i,a,n=this.options,s=n.valueRanges,l=n.colorRange,h=this.colorKey;l&&(i=x(l.from),a=x(l.to)),r(this.data,function(r){var p,d,m,c=r[h];if(s){for(m=s.length;m--;)if(p=s[m],i=p.from,a=p.to,(void 0===i||c>=i)&&(void 0===a||c<=a)){d=p.color;break}}else l&&void 0!==c&&(p=1-(e-c)/(e-t),d=null===c?n.nullColor:o(i,a,p));d&&(r.color=null,r.options.color=d)})},drawGraph:g,drawDataLabels:g,drawPoints:function(){var o=this.xAxis,e=this.yAxis,i=this.colorKey;r(this.data,function(t){t.plotY=1,null===t[i]&&(t[i]=0,t.isNull=!0)}),m.column.prototype.drawPoints.apply(this),r(this.data,function(t){var a=t.dataLabels,n=o.toPixels(t._minX,!0),r=o.toPixels(t._maxX,!0),s=e.toPixels(t._minY,!0),l=e.toPixels(t._maxY,!0);t.plotX=Math.round(n+(r-n)*h(a&&a.anchorX,.5)),t.plotY=Math.round(s+(l-s)*h(a&&a.anchorY,.5)),t.isNull&&(t[i]=null)}),t.Series.prototype.drawDataLabels.call(this)},animateDrilldown:function(t){var o=this.chart.plotBox,e=this.chart.drilldownLevels[this.chart.drilldownLevels.length-1],i=e.bBox,a=this.chart.options.drilldown.animation;t||(t=Math.min(i.width/o.width,i.height/o.height),e.shapeArgs={scaleX:t,scaleY:t,translateX:i.x,translateY:i.y},r(this.points,function(t){t.graphic.attr(e.shapeArgs).animate({scaleX:1,scaleY:1,translateX:0,translateY:0},a)}),delete this.animate)},animateDrillupFrom:function(t){m.column.prototype.animateDrillupFrom.call(this,t)},animateDrillupTo:function(t){m.column.prototype.animateDrillupTo.call(this,t)}}),c.mapline=l(c.map,{lineWidth:1,backgroundColor:"none"}),m.mapline=t.extendClass(m.map,{type:"mapline",pointAttrToOptions:{stroke:"color","stroke-width":"lineWidth",fill:"backgroundColor"},drawLegendSymbol:m.line.prototype.drawLegendSymbol}),c.mappoint=l(c.scatter,{dataLabels:{enabled:!0,format:"{point.name}",color:"black",style:{textShadow:"0 0 5px white"}}}),m.mappoint=t.extendClass(m.scatter,{type:"mappoint"}),t.Map=function(o,e){var i,a={endOnTick:!1,gridLineWidth:0,labels:{enabled:!1},lineWidth:0,minPadding:0,maxPadding:0,startOnTick:!1,tickWidth:0,title:null};return i=o.series,o.series=null,o=l({chart:{type:"map",panning:"xy"},xAxis:a,yAxis:l(a,{reversed:!0})},o,{chart:{inverted:!1}}),o.series=i,new t.Chart(o,e)}}(Highcharts);
|