bkjxxxw/WebContent/static/echarts-2.2.7/doc/slide/js/dist/chart/map.js

3 lines
66 KiB
JavaScript
Raw Normal View History

2024-03-18 10:04:33 +08:00
define("echarts/chart/map",["require","./base","zrender/shape/Text","zrender/shape/Path","zrender/shape/Circle","zrender/shape/Rectangle","zrender/shape/Line","zrender/shape/Polygon","zrender/shape/Ellipse","../component/dataRange","../component/roamController","../config","../util/ecData","zrender/tool/util","zrender/config","zrender/tool/event","../util/mapData/params","../util/mapData/textFixed","../util/mapData/geoCoord","../util/projection/svg","../util/projection/normal","../chart"],function(t){function e(t,e,s,o,a){i.call(this,t,e,s,o,a);var n=this;n._onmousewheel=function(t){return n.__onmousewheel(t)},n._onmousedown=function(t){return n.__onmousedown(t)},n._onmousemove=function(t){return n.__onmousemove(t)},n._onmouseup=function(t){return n.__onmouseup(t)},n._onroamcontroller=function(t){return n.__onroamcontroller(t)},n._ondrhoverlink=function(t){return n.__ondrhoverlink(t)},this._isAlive=!0,this._selectedMode={},this._activeMapType={},this._clickable={},this._hoverable={},this._showLegendSymbol={},this._selected={},this._mapTypeMap={},this._mapDataMap={},this._nameMap={},this._specialArea={},this._refreshDelayTicket,this._mapDataRequireCounter,this._markAnimation=!1,this._hoverLinkMap={},this._roamMap={},this._scaleLimitMap={},this._mx,this._my,this._mousedown,this._justMove,this._curMapType,this.refresh(o),this.zr.on(u.EVENT.MOUSEWHEEL,this._onmousewheel),this.zr.on(u.EVENT.MOUSEDOWN,this._onmousedown),e.bind(d.EVENT.ROAMCONTROLLER,this._onroamcontroller),e.bind(d.EVENT.DATA_RANGE_HOVERLINK,this._ondrhoverlink)}var i=t("./base"),s=t("zrender/shape/Text"),o=t("zrender/shape/Path"),a=t("zrender/shape/Circle"),n=t("zrender/shape/Rectangle"),r=t("zrender/shape/Line"),h=t("zrender/shape/Polygon"),l=t("zrender/shape/Ellipse");t("../component/dataRange"),t("../component/roamController");var d=t("../config");d.map={zlevel:0,z:2,mapType:"china",mapValuePrecision:0,showLegendSymbol:!0,dataRangeHoverLink:!0,hoverable:!0,clickable:!0,itemStyle:{normal:{borderColor:"rgba(0,0,0,0)",borderWidth:1,areaStyle:{color:"#ccc"},label:{show:!1,textStyle:{color:"rgb(139,69,19)"}}},emphasis:{borderColor:"rgba(0,0,0,0)",borderWidth:1,areaStyle:{color:"rgba(255,215,0,0.8)"},label:{show:!1,textStyle:{color:"rgb(100,0,0)"}}}}};var p=t("../util/ecData"),c=t("zrender/tool/util"),u=t("zrender/config"),g=t("zrender/tool/event"),f=t("../util/mapData/params").params,y=t("../util/mapData/textFixed"),m=t("../util/mapData/geoCoord");return e.prototype={type:d.CHART_TYPE_MAP,_buildShape:function(){var t=this.series;this.selectedMap={},this._activeMapType={};for(var e,i,s,o,a=this.component.legend,n={},r={},h={},l={},p=0,u=t.length;u>p;p++)if(t[p].type==d.CHART_TYPE_MAP&&(t[p]=this.reformOption(t[p]),i=t[p].mapType,r[i]=r[i]||{},r[i][p]=!0,h[i]=h[i]||t[p].mapValuePrecision,this._scaleLimitMap[i]=this._scaleLimitMap[i]||{},t[p].scaleLimit&&c.merge(this._scaleLimitMap[i],t[p].scaleLimit,!0),this._roamMap[i]=t[p].roam||this._roamMap[i],this._hoverLinkMap[i]=t[p].dataRangeHoverLink||this._hoverLinkMap[i],this._nameMap[i]=this._nameMap[i]||{},t[p].nameMap&&c.merge(this._nameMap[i],t[p].nameMap,!0),this._activeMapType[i]=!0,t[p].textFixed&&c.merge(y,t[p].textFixed,!0),t[p].geoCoord&&c.merge(m,t[p].geoCoord,!0),this._selectedMode[i]=this._selectedMode[i]||t[p].selectedMode,(null==this._hoverable[i]||this._hoverable[i])&&(this._hoverable[i]=t[p].hoverable),(null==this._clickable[i]||this._clickable[i])&&(this._clickable[i]=t[p].clickable),(null==this._showLegendSymbol[i]||this._showLegendSymbol[i])&&(this._showLegendSymbol[i]=t[p].showLegendSymbol),l[i]=l[i]||t[p].mapValueCalculation,e=t[p].name,this.selectedMap[e]=a?a.isSelected(e):!0,this.selectedMap[e])){n[i]=n[i]||{},s=t[p].data;for(var g=0,_=s.length;_>g;g++){o=this._nameChange(i,s[g].name),n[i][o]=n[i][o]||{seriesIndex:[]};for(var x in s[g])"value"!=x?n[i][o][x]=s[g][x]:isNaN(s[g].value)||(null==n[i][o].value&&(n[i][o].value=0),n[i][o].value+=s[g].value);n[i][o].seriesIndex.push(p)}}this._mapDataRequireCounter=0;for(var v in n)this._mapDataRequireCounter++;this._clearSelected(),0===this._mapDataRequ
},_buildFiller:function(){this._fillerShape={zlevel:this.getZlevelBase(),z:this.getZBase()+1,style:{x:this._calculableLocation.x,y:this._calculableLocation.y,width:this._calculableLocation.width,height:this._calculableLocation.height,color:"rgba(255,255,255,0)"},highlightStyle:{strokeColor:"rgba(255,255,255,0.5)",lineWidth:1},draggable:!0,ondrift:this._ondrift,ondragend:this._ondragend,onmousemove:this._dispatchHoverLink,_type:"filler"},this._fillerShape=new o(this._fillerShape),this.shapeList.push(this._fillerShape)},_bulidHandle:function(){var t,e,i,s,o,n,r,h,d=this._calculableLocation.x,p=this._calculableLocation.y,c=this._calculableLocation.width,u=this._calculableLocation.height,g=this.getFont(this.dataRangeOption.textStyle),f=l.getTextHeight("国",g),y=Math.max(l.getTextWidth(this._textFormat(this.dataRangeOption.max),g),l.getTextWidth(this._textFormat(this.dataRangeOption.min),g))+2;"horizontal"==this.dataRangeOption.orient?"bottom"!=this.dataRangeOption.y?(t=[[d,p],[d,p+u+f],[d-f,p+u+f],[d-1,p+u],[d-1,p]],e=d-y/2-f,i=p+u+f/2+2,s={x:d-y-f,y:p+u,width:y+f,height:f},o=[[d+c,p],[d+c,p+u+f],[d+c+f,p+u+f],[d+c+1,p+u],[d+c+1,p]],n=d+c+y/2+f,r=i,h={x:d+c,y:p+u,width:y+f,height:f}):(t=[[d,p+u],[d,p-f],[d-f,p-f],[d-1,p],[d-1,p+u]],e=d-y/2-f,i=p-f/2-2,s={x:d-y-f,y:p-f,width:y+f,height:f},o=[[d+c,p+u],[d+c,p-f],[d+c+f,p-f],[d+c+1,p],[d+c+1,p+u]],n=d+c+y/2+f,r=i,h={x:d+c,y:p-f,width:y+f,height:f}):(y+=f,"right"!=this.dataRangeOption.x?(t=[[d,p],[d+c+f,p],[d+c+f,p-f],[d+c,p-1],[d,p-1]],e=d+c+y/2+f/2,i=p-f/2,s={x:d+c,y:p-f,width:y+f,height:f},o=[[d,p+u],[d+c+f,p+u],[d+c+f,p+f+u],[d+c,p+1+u],[d,p+u+1]],n=e,r=p+u+f/2,h={x:d+c,y:p+u,width:y+f,height:f}):(t=[[d+c,p],[d-f,p],[d-f,p-f],[d,p-1],[d+c,p-1]],e=d-y/2-f/2,i=p-f/2,s={x:d-y-f,y:p-f,width:y+f,height:f},o=[[d+c,p+u],[d-f,p+u],[d-f,p+f+u],[d,p+1+u],[d+c,p+u+1]],n=e,r=p+u+f/2,h={x:d-y-f,y:p+u,width:y+f,height:f})),this._startShape={style:{pointList:t,text:this._textFormat(this.dataRangeOption.max),textX:e,textY:i,textFont:g,color:this.getColor(this.dataRangeOption.max),rect:s,x:t[0][0],y:t[0][1],_x:t[0][0],_y:t[0][1]}},this._startShape.highlightStyle={strokeColor:this._startShape.style.color,lineWidth:1},this._endShape={style:{pointList:o,text:this._textFormat(this.dataRangeOption.min),textX:n,textY:r,textFont:g,color:this.getColor(this.dataRangeOption.min),rect:h,x:o[0][0],y:o[0][1],_x:o[0][0],_y:o[0][1]}},this._endShape.highlightStyle={strokeColor:this._endShape.style.color,lineWidth:1},this._startShape.zlevel=this._endShape.zlevel=this.getZlevelBase(),this._startShape.z=this._endShape.z=this.getZBase()+1,this._startShape.draggable=this._endShape.draggable=!0,this._startShape.ondrift=this._endShape.ondrift=this._ondrift,this._startShape.ondragend=this._endShape.ondragend=this._ondragend,this._startShape.style.textColor=this._endShape.style.textColor=this.dataRangeOption.textStyle.color,this._startShape.style.textAlign=this._endShape.style.textAlign="center",this._startShape.style.textPosition=this._endShape.style.textPosition="specific",this._startShape.style.textBaseline=this._endShape.style.textBaseline="middle",this._startShape.style.width=this._endShape.style.width=0,this._startShape.style.height=this._endShape.style.height=0,this._startShape.style.textPosition=this._endShape.style.textPosition="specific",this._startShape=new a(this._startShape),this._endShape=new a(this._endShape),this.shapeList.push(this._startShape),this.shapeList.push(this._endShape)},_bulidMask:function(){var t=this._calculableLocation.x,e=this._calculableLocation.y,i=this._calculableLocation.width,s=this._calculableLocation.height;this._startMask={zlevel:this.getZlevelBase(),z:this.getZBase()+1,style:{x:t,y:e,width:"horizontal"==this.dataRangeOption.orient?0:i,height:"horizontal"==this.dataRangeOption.orient?s:0,color:"#ccc"},hoverable:!1},this._endMask={zlevel:this.getZlevelBase(),z:this.getZBase()+1,style:{x:"horizontal"==this.dataRangeOption.orient?t+i:t,y:"horizontal"==this.dataRangeOption.orient?e:e+s,width:"horizontal"==this.dataRangeOption.orient?0:i,height:"horizontal"==this.dataRangeOption.
return e instanceof Array?(i=1*e[0],s=1*e[1]):(i=1*e.x,s=1*e.y),i=i/t.scale.x+t.offset.x-168.5,i=i>180?i-360:i,s=90-(s/t.scale.y+t.offset.y),[i,s]}function o(t,e){return a.offset=t.offset,a.scale=t.scale,a.makePoint(e instanceof Array?[1*e[0],1*e[1]]:[1*e.x,1*e.y])}var a={formatPoint:function(t){return[(t[0]<-168.5&&t[1]>63.8?t[0]+360:t[0])+168.5,90-t[1]]},makePoint:function(t){var e=this,i=e.formatPoint(t);e._bbox.xmin>t[0]&&(e._bbox.xmin=t[0]),e._bbox.xmax<t[0]&&(e._bbox.xmax=t[0]),e._bbox.ymin>t[1]&&(e._bbox.ymin=t[1]),e._bbox.ymax<t[1]&&(e._bbox.ymax=t[1]);var s=(i[0]-a.offset.x)*a.scale.x+a.offset.left,o=(i[1]-a.offset.y)*a.scale.y+a.offset.top;return[s,o]},Point:function(t){return t=this.makePoint(t),t.join(",")},LineString:function(t){for(var e,i="",s=0,o=t.length;o>s;s++)e=a.makePoint(t[s]),i=0===s?"M"+e.join(","):i+"L"+e.join(",");return i},Polygon:function(t){for(var e="",i=0,s=t.length;s>i;i++)e=e+a.LineString(t[i])+"z";return e},MultiPoint:function(t){for(var e=[],i=0,s=t.length;s>i;i++)e.push(a.Point(t[i]));return e},MultiLineString:function(t){for(var e="",i=0,s=t.length;s>i;i++)e+=a.LineString(t[i]);return e},MultiPolygon:function(t){for(var e="",i=0,s=t.length;s>i;i++)e+=a.Polygon(t[i]);return e}},n={formatPoint:a.formatPoint,makePoint:function(t){var e=this,i=e.formatPoint(t),s=i[0],o=i[1];e.xmin>s&&(e.xmin=s),e.xmax<s&&(e.xmax=s),e.ymin>o&&(e.ymin=o),e.ymax<o&&(e.ymax=o)},Point:function(t){this.makePoint(t)},LineString:function(t){for(var e=0,i=t.length;i>e;e++)this.makePoint(t[e])},Polygon:function(t){for(var e=0,i=t.length;i>e;e++)this.LineString(t[e])},MultiPoint:function(t){for(var e=0,i=t.length;i>e;e++)this.Point(t[e])},MultiLineString:function(t){for(var e=0,i=t.length;i>e;e++)this.LineString(t[e])},MultiPolygon:function(t){for(var e=0,i=t.length;i>e;e++)this.Polygon(t[e])}};return{getBbox:t,geoJson2Path:i,pos2geo:s,geo2pos:o}}),define("echarts/util/shape/HandlePolygon",["require","zrender/shape/Base","zrender/shape/Polygon","zrender/tool/util"],function(t){function e(t){i.call(this,t)}var i=t("zrender/shape/Base"),s=t("zrender/shape/Polygon"),o=t("zrender/tool/util");return e.prototype={type:"handle-polygon",buildPath:function(t,e){s.prototype.buildPath(t,e)},isCover:function(t,e){var i=this.getTansform(t,e);t=i[0],e=i[1];var s=this.style.rect;return t>=s.x&&t<=s.x+s.width&&e>=s.y&&e<=s.y+s.height?!0:!1}},o.inherits(e,i),e});