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