lixin-web
Version:
vue and bootstrap
2 lines • 447 kB
JavaScript
define("echarts/chart/map",["require","../component/base","./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(e){function t(e,t,a,o,s){n.call(this,e,t,a,o,s),i.call(this);var r=this;r._onmousewheel=function(e){return r.__onmousewheel(e)},r._onmousedown=function(e){return r.__onmousedown(e)},r._onmousemove=function(e){return r.__onmousemove(e)},r._onmouseup=function(e){return r.__onmouseup(e)},r._onroamcontroller=function(e){return r.__onroamcontroller(e)},r._ondrhoverlink=function(e){return r.__ondrhoverlink(e)},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(p.EVENT.MOUSEWHEEL,this._onmousewheel),this.zr.on(p.EVENT.MOUSEDOWN,this._onmousedown),t.bind(V.EVENT.ROAMCONTROLLER,this._onroamcontroller),t.bind(V.EVENT.DATA_RANGE_HOVERLINK,this._ondrhoverlink)}var n=e("../component/base"),i=e("./base"),a=e("zrender/shape/Text"),o=e("zrender/shape/Path"),s=e("zrender/shape/Circle"),r=e("zrender/shape/Rectangle"),l=e("zrender/shape/Line"),h=e("zrender/shape/Polygon"),m=e("zrender/shape/Ellipse");e("../component/dataRange"),e("../component/roamController");var V=e("../config"),U=e("../util/ecData"),d=e("zrender/tool/util"),p=e("zrender/config"),c=e("zrender/tool/event"),u=e("../util/mapData/params").params,y=e("../util/mapData/textFixed"),g=e("../util/mapData/geoCoord");return t.prototype={type:V.CHART_TYPE_MAP,_buildShape:function(){var e=this.series;this.selectedMap={},this._activeMapType={};for(var t,n,i,a,o=this.component.legend,s={},r={},l={},h={},m=0,U=e.length;U>m;m++)if(e[m].type==V.CHART_TYPE_MAP&&(e[m]=this.reformOption(e[m]),n=e[m].mapType,r[n]=r[n]||{},r[n][m]=!0,l[n]=l[n]||e[m].mapValuePrecision,this._scaleLimitMap[n]=this._scaleLimitMap[n]||{},e[m].scaleLimit&&d.merge(this._scaleLimitMap[n],e[m].scaleLimit,!0),this._roamMap[n]=e[m].roam||this._roamMap[n],this._hoverLinkMap[n]=e[m].dataRangeHoverLink||this._hoverLinkMap[n],this._nameMap[n]=this._nameMap[n]||{},e[m].nameMap&&d.merge(this._nameMap[n],e[m].nameMap,!0),this._activeMapType[n]=!0,e[m].textFixed&&d.merge(y,e[m].textFixed,!0),e[m].geoCoord&&d.merge(g,e[m].geoCoord,!0),this._selectedMode[n]=this._selectedMode[n]||e[m].selectedMode,(null==this._hoverable[n]||this._hoverable[n])&&(this._hoverable[n]=e[m].hoverable),(null==this._clickable[n]||this._clickable[n])&&(this._clickable[n]=e[m].clickable),(null==this._showLegendSymbol[n]||this._showLegendSymbol[n])&&(this._showLegendSymbol[n]=e[m].showLegendSymbol),h[n]=h[n]||e[m].mapValueCalculation,t=e[m].name,this.selectedMap[t]=o?o.isSelected(t):!0,this.selectedMap[t])){s[n]=s[n]||{},i=e[m].data;for(var p=0,c=i.length;c>p;p++){a=this._nameChange(n,i[p].name),s[n][a]=s[n][a]||{seriesIndex:[]};for(var b in i[p])"value"!=b?s[n][a][b]=i[p][b]:isNaN(i[p].value)||(null==s[n][a].value&&(s[n][a].value=0),s[n][a].value+=i[p].value);s[n][a].seriesIndex.push(m)}}this._mapDataRequireCounter=0;for(var f in s)this._mapDataRequireCounter++;this._clearSelected(),0===this._mapDataRequireCounter&&(this.clear(),this.zr&&this.zr.delShape(this.lastShapeList),this.lastShapeList=[]);for(var f in s){if(h[f]&&"average"==h[f])for(var c in s[f])s[f][c].value=(s[f][c].value/s[f][c].seriesIndex.length).toFixed(l[f])-0;this._mapDataMap[f]=this._mapDataMap[f]||{},this._mapDataMap[f].mapData?this._mapDataCallback(f,s[f],r[f])(this._mapDataMap[f].mapData):u[f.replace(/\|.*/,"")].getGeoJson&&(this._specialArea[f]=u[f.replace(/\|.*/,"")].specialArea||this._specialArea[f],u[f.replace(/\|.*/,"")].getGeoJson(this._mapDataCallback(f,s[f],r[f])))}},_mapDataCallback:function(t,n,i){var a=this;return function(o){a._isAlive&&null!=a._activeMapType[t]&&(-1!=t.indexOf("|")&&(o=a._getSubMapData(t,o)),a._mapDataMap[t].mapData=o,o.firstChild?(a._mapDataMap[t].rate=1,a._mapDataMap[t].projection=e("../util/projection/svg")):(a._mapDataMap[t].rate=.75,a._mapDataMap[t].projection=e("../util/projection/normal")),a._buildMap(t,a._getProjectionData(t,o,i),n,i),a._buildMark(t,i),--a._mapDataRequireCounter<=0&&(a.addShapeList(),a.zr.refresh()))}},_clearSelected:function(){for(var e in this._selected)this._activeMapType[this._mapTypeMap[e]]||(delete this._selected[e],delete this._mapTypeMap[e])},_getSubMapData:function(e,t){for(var n=e.replace(/^.*\|/,""),i=t.features,a=0,o=i.length;o>a;a++)if(i[a].properties&&i[a].properties.name==n){i=i[a],"United States of America"==n&&i.geometry.coordinates.length>1&&(i={geometry:{coordinates:i.geometry.coordinates.slice(5,6),type:i.geometry.type},id:i.id,properties:i.properties,type:i.type});break}return{type:"FeatureCollection",features:[i]}},_getProjectionData:function(e,t,n){var i,a=this._mapDataMap[e].projection,o=[],s=this._mapDataMap[e].bbox||a.getBbox(t,this._specialArea[e]);i=this._mapDataMap[e].hasRoam?this._mapDataMap[e].transform:this._getTransform(s,n,this._mapDataMap[e].rate);var r,l=this._mapDataMap[e].lastTransform||{scale:{}};i.left!=l.left||i.top!=l.top||i.scale.x!=l.scale.x||i.scale.y!=l.scale.y?(r=a.geoJson2Path(t,i,this._specialArea[e]),l=d.clone(i)):(i=this._mapDataMap[e].transform,r=this._mapDataMap[e].pathArray),this._mapDataMap[e].bbox=s,this._mapDataMap[e].transform=i,this._mapDataMap[e].lastTransform=l,this._mapDataMap[e].pathArray=r;for(var h=[i.left,i.top],m=0,V=r.length;V>m;m++)o.push(this._getSingleProvince(e,r[m],h));if(this._specialArea[e])for(var U in this._specialArea[e])o.push(this._getSpecialProjectionData(e,t,U,this._specialArea[e][U],h));if("china"==e){var p=this.geo2pos(e,g["南海诸岛"]||u["南海诸岛"].textCoord),c=i.scale.x/10.5,b=[32*c+p[0],83*c+p[1]];y["南海诸岛"]&&(b[0]+=y["南海诸岛"][0],b[1]+=y["南海诸岛"][1]),o.push({name:this._nameChange(e,"南海诸岛"),path:u["南海诸岛"].getPath(p,c),position:h,textX:b[0],textY:b[1]})}return o},_getSpecialProjectionData:function(t,n,i,a,o){n=this._getSubMapData("x|"+i,n);var s=e("../util/projection/normal"),r=s.getBbox(n),l=this.geo2pos(t,[a.left,a.top]),h=this.geo2pos(t,[a.left+a.width,a.top+a.height]),m=Math.abs(h[0]-l[0]),V=Math.abs(h[1]-l[1]),U=r.width,d=r.height,p=m/.75/U,c=V/d;p>c?(p=.75*c,m=U*p):(c=p,p=.75*c,V=d*c);var u={OffsetLeft:l[0],OffsetTop:l[1],scale:{x:p,y:c}},y=s.geoJson2Path(n,u);return this._getSingleProvince(t,y[0],o)},_getSingleProvince:function(e,t,n){var i,a=t.properties.name,o=y[a]||[0,0];if(g[a])i=this.geo2pos(e,g[a]);else if(t.cp)i=[t.cp[0]+o[0],t.cp[1]+o[1]];else{var s=this._mapDataMap[e].bbox;i=this.geo2pos(e,[s.left+s.width/2,s.top+s.height/2]),i[0]+=o[0],i[1]+=o[1]}return t.name=this._nameChange(e,a),t.position=n,t.textX=i[0],t.textY=i[1],t},_getTransform:function(e,t,n){var i,a,o,s,r,l,h,m=this.series,V=this.zr.getWidth(),U=this.zr.getHeight(),d=Math.round(.02*Math.min(V,U));for(var p in t)i=m[p].mapLocation||{},o=i.x||o,r=i.y||r,l=i.width||l,h=i.height||h;a=this.parsePercent(o,V),a=isNaN(a)?d:a,s=this.parsePercent(r,U),s=isNaN(s)?d:s,l=null==l?V-a-2*d:this.parsePercent(l,V),h=null==h?U-s-2*d:this.parsePercent(h,U);var c=e.width,u=e.height,y=l/n/c,g=h/u;if(y>g?(y=g*n,l=c*y):(g=y,y=g*n,h=u*g),isNaN(o))switch(o=o||"center",o+""){case"center":a=Math.floor((V-l)/2);break;case"right":a=V-l}if(isNaN(r))switch(r=r||"center",r+""){case"center":s=Math.floor((U-h)/2);break;case"bottom":s=U-h}return{left:a,top:s,width:l,height:h,baseScale:1,scale:{x:y,y:g}}},_buildMap:function(e,t,n,i){for(var V,p,c,u,y,g,b,f,k,_,x,L=this.series,W=this.component.legend,X=this.component.dataRange,K=this.ecTheme.map,w=0,I=t.length;I>w;w++){if(f=d.clone(t[w]),k={name:f.name,path:f.path,position:d.clone(f.position)},p=f.name,c=n[p]){y=[c],V="";for(var v=0,J=c.seriesIndex.length;J>v;v++)y.push(L[c.seriesIndex[v]]),V+=L[c.seriesIndex[v]].name+" ",W&&this._showLegendSymbol[e]&&W.hasColor(L[c.seriesIndex[v]].name)&&this.shapeList.push(new s({zlevel:this._zlevelBase+1,position:d.clone(f.position),_mapType:e,style:{x:f.textX+3+7*v,y:f.textY-10,r:3,color:W.getColor(L[c.seriesIndex[v]].name)},hoverable:!1}));y.push(K),u=c.value}else{c="-",V="",y=[];for(var C in i)y.push(L[C]);y.push(K),u="-"}switch(g=X&&!isNaN(u)?X.getColor(u):null,f.color=f.color||g||this.getItemStyleColor(this.deepQuery(y,"itemStyle.normal.color"),c.seriesIndex,-1,c)||this.deepQuery(y,"itemStyle.normal.areaStyle.color"),f.strokeColor=f.strokeColor||this.deepQuery(y,"itemStyle.normal.borderColor"),f.lineWidth=f.lineWidth||this.deepQuery(y,"itemStyle.normal.borderWidth"),k.color=this.getItemStyleColor(this.deepQuery(y,"itemStyle.emphasis.color"),c.seriesIndex,-1,c)||this.deepQuery(y,"itemStyle.emphasis.areaStyle.color")||f.color,k.strokeColor=this.deepQuery(y,"itemStyle.emphasis.borderColor")||f.strokeColor,k.lineWidth=this.deepQuery(y,"itemStyle.emphasis.borderWidth")||f.lineWidth,f.brushType=k.brushType=f.brushType||"both",f.lineJoin=k.lineJoin="round",f._name=k._name=p,b=this.deepQuery(y,"itemStyle.normal.label.textStyle"),x={zlevel:this._zlevelBase+1,position:d.clone(f.position),_mapType:e,_geo:this.pos2geo(e,[f.textX,f.textY]),style:{brushType:"fill",x:f.textX,y:f.textY,text:this.getLabelText(p,u,y,"normal"),_name:p,textAlign:"center",color:this.deepQuery(y,"itemStyle.normal.label.show")?this.deepQuery(y,"itemStyle.normal.label.textStyle.color"):"rgba(0,0,0,0)",textFont:this.getFont(b)}},x._style=d.clone(x.style),x.highlightStyle=d.clone(x.style),this.deepQuery(y,"itemStyle.emphasis.label.show")?(x.highlightStyle.text=this.getLabelText(p,u,y,"emphasis"),x.highlightStyle.color=this.deepQuery(y,"itemStyle.emphasis.label.textStyle.color")||x.style.color,b=this.deepQuery(y,"itemStyle.emphasis.label.textStyle")||b,x.highlightStyle.textFont=this.getFont(b)):x.highlightStyle.color="rgba(0,0,0,0)",_={zlevel:this._zlevelBase,position:d.clone(f.position),style:f,highlightStyle:k,_style:d.clone(f),_mapType:e},null!=f.scale&&(_.scale=d.clone(f.scale)),x=new a(x),_.style.shapeType){case"rectangle":_=new r(_);break;case"line":_=new l(_);break;case"circle":_=new s(_);break;case"polygon":_=new h(_);break;case"ellipse":_=new m(_);break;default:_=new o(_),_.buildPathArray&&(_.style.pathArray=_.buildPathArray(_.style.path))}(this._selectedMode[e]&&this._selected[p]||c.selected&&this._selected[p]!==!1)&&(x.style=x.highlightStyle,_.style=_.highlightStyle),x.clickable=_.clickable=this._clickable[e]&&(null==c.clickable||c.clickable),this._selectedMode[e]&&(this._selected[p]=null!=this._selected[p]?this._selected[p]:c.selected,this._mapTypeMap[p]=e,(null==c.selectable||c.selectable)&&(_.clickable=x.clickable=!0,_.onclick=x.onclick=this.shapeHandler.onclick)),this._hoverable[e]&&(null==c.hoverable||c.hoverable)?(x.hoverable=_.hoverable=!0,_.hoverConnect=x.id,x.hoverConnect=_.id):x.hoverable=_.hoverable=!1,U.pack(x,{name:V,tooltip:this.deepQuery(y,"tooltip")},0,c,0,p),this.shapeList.push(x),U.pack(_,{name:V,tooltip:this.deepQuery(y,"tooltip")},0,c,0,p),this.shapeList.push(_)}},_buildMark:function(e,t){this._seriesIndexToMapType=this._seriesIndexToMapType||{},this.markAttachStyle=this.markAttachStyle||{};var n=[this._mapDataMap[e].transform.left,this._mapDataMap[e].transform.top];"none"==e&&(n=[0,0]);for(var i in t)this._seriesIndexToMapType[i]=e,this.markAttachStyle[i]={position:n,_mapType:e},this.buildMark(i)},getMarkCoord:function(e,t){return t.geoCoord||g[t.name]?this.geo2pos(this._seriesIndexToMapType[e],t.geoCoord||g[t.name]):[0,0]},getMarkGeo:function(e){return e.geoCoord||g[e.name]},_nameChange:function(e,t){return this._nameMap[e][t]||t},getLabelText:function(e,t,n,i){var a=this.deepQuery(n,"itemStyle."+i+".label.formatter");return a?"function"==typeof a?a.call(this.myChart,e,t):"string"==typeof a?(a=a.replace("{a}","{a0}").replace("{b}","{b0}"),a=a.replace("{a0}",e).replace("{b0}",t)):void 0:e},_findMapTypeByPos:function(e,t){var n,i,a,o,s;for(var r in this._mapDataMap)if(n=this._mapDataMap[r].transform,n&&this._roamMap[r]&&this._activeMapType[r]&&(i=n.left,a=n.top,o=n.width,s=n.height,e>=i&&i+o>=e&&t>=a&&a+s>=t))return r},__onmousewheel:function(e){if(!(this.shapeList.length<=0)){var t,n,i=e.event,a=c.getX(i),o=c.getY(i),s=c.getDelta(i),r=e.mapTypeControl;r||(r={},n=this._findMapTypeByPos(a,o),n&&this._roamMap[n]&&"move"!=this._roamMap[n]&&(r[n]=!0));var l=!1;for(n in r)if(r[n]){l=!0;var h=this._mapDataMap[n].transform,m=h.left,U=h.top,d=h.width,p=h.height,u=this.pos2geo(n,[a-m,o-U]);if(s>0){if(t=1.2,null!=this._scaleLimitMap[n].max&&h.baseScale>=this._scaleLimitMap[n].max)continue}else if(t=1/1.2,null!=this._scaleLimitMap[n].min&&h.baseScale<=this._scaleLimitMap[n].min)continue;h.baseScale*=t,h.scale.x*=t,h.scale.y*=t,h.width=d*t,h.height=p*t,this._mapDataMap[n].hasRoam=!0,this._mapDataMap[n].transform=h,u=this.geo2pos(n,u),h.left-=u[0]-(a-m),h.top-=u[1]-(o-U),this._mapDataMap[n].transform=h,this.clearEffectShape(!0);for(var y=0,g=this.shapeList.length;g>y;y++)this.shapeList[y]._mapType==n&&(this.shapeList[y].position[0]=h.left,this.shapeList[y].position[1]=h.top,"path"==this.shapeList[y].type||"symbol"==this.shapeList[y].type||"circle"==this.shapeList[y].type||"rectangle"==this.shapeList[y].type||"polygon"==this.shapeList[y].type||"line"==this.shapeList[y].type||"ellipse"==this.shapeList[y].type?(this.shapeList[y].scale[0]*=t,this.shapeList[y].scale[1]*=t):"mark-line"==this.shapeList[y].type?(this.shapeList[y].style.pointListLength=void 0,this.shapeList[y].style.pointList=!1,u=this.geo2pos(n,this.shapeList[y]._geo[0]),this.shapeList[y].style.xStart=u[0],this.shapeList[y].style.yStart=u[1],u=this.geo2pos(n,this.shapeList[y]._geo[1]),this.shapeList[y]._x=this.shapeList[y].style.xEnd=u[0],this.shapeList[y]._y=this.shapeList[y].style.yEnd=u[1]):"icon"==this.shapeList[y].type?(u=this.geo2pos(n,this.shapeList[y]._geo),this.shapeList[y].style.x=this.shapeList[y].style._x=u[0]-this.shapeList[y].style.width/2,this.shapeList[y].style.y=this.shapeList[y].style._y=u[1]-this.shapeList[y].style.height/2):(u=this.geo2pos(n,this.shapeList[y]._geo),this.shapeList[y].style.x=u[0],this.shapeList[y].style.y=u[1],"text"==this.shapeList[y].type&&(this.shapeList[y]._style.x=this.shapeList[y].highlightStyle.x=u[0],this.shapeList[y]._style.y=this.shapeList[y].highlightStyle.y=u[1])),this.zr.modShape(this.shapeList[y].id))}if(l){c.stop(i),this.zr.refresh();var b=this;clearTimeout(this._refreshDelayTicket),this._refreshDelayTicket=setTimeout(function(){b&&b.shapeList&&b.animationEffect()},100),this.messageCenter.dispatch(V.EVENT.MAP_ROAM,e.event,{type:"scale"},this.myChart)}}},__onmousedown:function(e){if(!(this.shapeList.length<=0)){var t=e.target;if(!t||!t.draggable){var n=e.event,i=c.getX(n),a=c.getY(n),o=this._findMapTypeByPos(i,a);if(o&&this._roamMap[o]&&"scale"!=this._roamMap[o]){this._mousedown=!0,this._mx=i,this._my=a,this._curMapType=o,this.zr.on(p.EVENT.MOUSEUP,this._onmouseup);var s=this;setTimeout(function(){s.zr.on(p.EVENT.MOUSEMOVE,s._onmousemove)},100)}}}},__onmousemove:function(e){if(this._mousedown&&this._isAlive){var t=e.event,n=c.getX(t),i=c.getY(t),a=this._mapDataMap[this._curMapType].transform;a.hasRoam=!0,a.left-=this._mx-n,a.top-=this._my-i,this._mx=n,this._my=i,this._mapDataMap[this._curMapType].transform=a;for(var o=0,s=this.shapeList.length;s>o;o++)this.shapeList[o]._mapType==this._curMapType&&(this.shapeList[o].position[0]=a.left,this.shapeList[o].position[1]=a.top,this.zr.modShape(this.shapeList[o].id));this.messageCenter.dispatch(V.EVENT.MAP_ROAM,e.event,{type:"move"},this.myChart),this.clearEffectShape(!0),this.zr.refresh(),this._justMove=!0,c.stop(t)}},__onmouseup:function(e){var t=e.event;this._mx=c.getX(t),this._my=c.getY(t),this._mousedown=!1;var n=this;setTimeout(function(){n._justMove&&n.animationEffect(),n._justMove=!1,n.zr.un(p.EVENT.MOUSEMOVE,n._onmousemove),n.zr.un(p.EVENT.MOUSEUP,n._onmouseup)},120)},__onroamcontroller:function(e){var t=e.event;t.zrenderX=this.zr.getWidth()/2,t.zrenderY=this.zr.getHeight()/2;var n=e.mapTypeControl,i=0,a=0,o=e.step;switch(e.roamType){case"scaleUp":return t.zrenderDelta=1,void this.__onmousewheel({event:t,mapTypeControl:n});case"scaleDown":return t.zrenderDelta=-1,void this.__onmousewheel({event:t,mapTypeControl:n});case"up":i=-o;break;case"down":i=o;break;case"left":a=-o;break;case"right":a=o}var s,r;for(r in n)this._mapDataMap[r]&&this._activeMapType[r]&&(s=this._mapDataMap[r].transform,s.hasRoam=!0,s.left-=a,s.top-=i,this._mapDataMap[r].transform=s);for(var l=0,h=this.shapeList.length;h>l;l++)r=this.shapeList[l]._mapType,n[r]&&this._activeMapType[r]&&(s=this._mapDataMap[r].transform,this.shapeList[l].position[0]=s.left,this.shapeList[l].position[1]=s.top,this.zr.modShape(this.shapeList[l].id));this.messageCenter.dispatch(V.EVENT.MAP_ROAM,e.event,{type:"move"},this.myChart),this.clearEffectShape(!0),this.zr.refresh(),clearTimeout(this.dircetionTimer);var m=this;this.dircetionTimer=setTimeout(function(){m.animationEffect()},150)},__ondrhoverlink:function(e){for(var t,n,i=0,a=this.shapeList.length;a>i;i++)t=this.shapeList[i]._mapType,this._hoverLinkMap[t]&&this._activeMapType[t]&&(n=U.get(this.shapeList[i],"value"),null!=n&&n>=e.valueMin&&n<=e.valueMax&&this.zr.addHoverShape(this.shapeList[i]))},onclick:function(e){if(this.isClick&&e.target&&!this._justMove&&"icon"!=e.target.type){this.isClick=!1;var t=e.target,n=t.style._name,i=this.shapeList.length,a=t._mapType||"";if("single"==this._selectedMode[a])for(var o in this._selected)if(this._selected[o]&&this._mapTypeMap[o]==a){for(var s=0;i>s;s++)this.shapeList[s].style._name==o&&this.shapeList[s]._mapType==a&&(this.shapeList[s].style=this.shapeList[s]._style,this.zr.modShape(this.shapeList[s].id));o!=n&&(this._selected[o]=!1)}this._selected[n]=!this._selected[n];for(var s=0;i>s;s++)this.shapeList[s].style._name==n&&this.shapeList[s]._mapType==a&&(this.shapeList[s].style=this._selected[n]?this.shapeList[s].highlightStyle:this.shapeList[s]._style,this.zr.modShape(this.shapeList[s].id));this.messageCenter.dispatch(V.EVENT.MAP_SELECTED,e.event,{selected:this._selected,target:n},this.myChart),this.zr.refresh();var r=this;setTimeout(function(){r.zr.trigger(p.EVENT.MOUSEMOVE,e.event)},100)}},refresh:function(e){e&&(this.option=e,this.series=e.series),this._mapDataRequireCounter>0?this.clear():this.backupShapeList(),this._buildShape(),this.zr.refreshHover()},ondataRange:function(e,t){this.component.dataRange&&(this.refresh(),t.needRefresh=!0)},pos2geo:function(e,t){return this._mapDataMap[e].transform?this._mapDataMap[e].projection.pos2geo(this._mapDataMap[e].transform,t):null},getGeoByPos:function(e,t){if(!this._mapDataMap[e].transform)return null;var n=[this._mapDataMap[e].transform.left,this._mapDataMap[e].transform.top];return t instanceof Array?(t[0]-=n[0],t[1]-=n[1]):(t.x-=n[0],t.y-=n[1]),this.pos2geo(e,t)},geo2pos:function(e,t){return this._mapDataMap[e].transform?this._mapDataMap[e].projection.geo2pos(this._mapDataMap[e].transform,t):null},getPosByGeo:function(e,t){if(!this._mapDataMap[e].transform)return null;var n=this.geo2pos(e,t);return n[0]+=this._mapDataMap[e].transform.left,n[1]+=this._mapDataMap[e].transform.top,n},getMapPosition:function(e){return this._mapDataMap[e].transform?[this._mapDataMap[e].transform.left,this._mapDataMap[e].transform.top]:null},onbeforDispose:function(){this._isAlive=!1,this.zr.un(p.EVENT.MOUSEWHEEL,this._onmousewheel),this.zr.un(p.EVENT.MOUSEDOWN,this._onmousedown),this.messageCenter.unbind(V.EVENT.ROAMCONTROLLER,this._onroamcontroller),this.messageCenter.unbind(V.EVENT.DATA_RANGE_HOVERLINK,this._ondrhoverlink)}},d.inherits(t,i),d.inherits(t,n),e("../chart").define("map",t),t}),define("zrender/shape/Path",["require","./Base","./util/PathProxy","../tool/util"],function(e){var t=e("./Base"),n=e("./util/PathProxy"),i=n.PathSegment,a=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},o=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(a(e)*a(t))},s=function(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(o(e,t))},r=function(e){t.call(this,e)};return r.prototype={type:"path",buildPathArray:function(e,t,n){if(!e)return[];t=t||0,n=n||0;var a=e,o=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];a=a.replace(/-/g," -"),a=a.replace(/ /g," "),a=a.replace(/ /g,","),a=a.replace(/,,/g,",");var s;for(s=0;s<o.length;s++)a=a.replace(new RegExp(o[s],"g"),"|"+o[s]);var r=a.split("|"),l=[],h=0,m=0;for(s=1;s<r.length;s++){var V=r[s],U=V.charAt(0);V=V.slice(1),V=V.replace(new RegExp("e,-","g"),"e-");var d=V.split(",");d.length>0&&""===d[0]&&d.shift();for(var p=0;p<d.length;p++)d[p]=parseFloat(d[p]);for(;d.length>0&&!isNaN(d[0]);){var c,u,y,g,b,f,k,_,x=null,L=[],W=h,X=m;switch(U){case"l":h+=d.shift(),m+=d.shift(),x="L",L.push(h,m);break;case"L":h=d.shift(),m=d.shift(),L.push(h,m);break;case"m":h+=d.shift(),m+=d.shift(),x="M",L.push(h,m),U="l";break;case"M":h=d.shift(),m=d.shift(),x="M",L.push(h,m),U="L";break;case"h":h+=d.shift(),x="L",L.push(h,m);break;case"H":h=d.shift(),x="L",L.push(h,m);break;case"v":m+=d.shift(),x="L",L.push(h,m);break;case"V":m=d.shift(),x="L",L.push(h,m);break;case"C":L.push(d.shift(),d.shift(),d.shift(),d.shift()),h=d.shift(),m=d.shift(),L.push(h,m);break;case"c":L.push(h+d.shift(),m+d.shift(),h+d.shift(),m+d.shift()),h+=d.shift(),m+=d.shift(),x="C",L.push(h,m);break;case"S":c=h,u=m,y=l[l.length-1],"C"===y.command&&(c=h+(h-y.points[2]),u=m+(m-y.points[3])),L.push(c,u,d.shift(),d.shift()),h=d.shift(),m=d.shift(),x="C",L.push(h,m);break;case"s":c=h,u=m,y=l[l.length-1],"C"===y.command&&(c=h+(h-y.points[2]),u=m+(m-y.points[3])),L.push(c,u,h+d.shift(),m+d.shift()),h+=d.shift(),m+=d.shift(),x="C",L.push(h,m);break;case"Q":L.push(d.shift(),d.shift()),h=d.shift(),m=d.shift(),L.push(h,m);break;case"q":L.push(h+d.shift(),m+d.shift()),h+=d.shift(),m+=d.shift(),x="Q",L.push(h,m);break;case"T":c=h,u=m,y=l[l.length-1],"Q"===y.command&&(c=h+(h-y.points[0]),u=m+(m-y.points[1])),h=d.shift(),m=d.shift(),x="Q",L.push(c,u,h,m);break;case"t":c=h,u=m,y=l[l.length-1],"Q"===y.command&&(c=h+(h-y.points[0]),u=m+(m-y.points[1])),h+=d.shift(),m+=d.shift(),x="Q",L.push(c,u,h,m);break;case"A":g=d.shift(),b=d.shift(),f=d.shift(),k=d.shift(),_=d.shift(),W=h,X=m,h=d.shift(),m=d.shift(),x="A",L=this._convertPoint(W,X,h,m,k,_,g,b,f);break;case"a":g=d.shift(),b=d.shift(),f=d.shift(),k=d.shift(),_=d.shift(),W=h,X=m,h+=d.shift(),m+=d.shift(),x="A",L=this._convertPoint(W,X,h,m,k,_,g,b,f)}for(var K=0,w=L.length;w>K;K+=2)L[K]+=t,L[K+1]+=n;l.push(new i(x||U,L))}("z"===U||"Z"===U)&&l.push(new i("z",[]))}return l},_convertPoint:function(e,t,n,i,a,r,l,h,m){var V=m*(Math.PI/180),U=Math.cos(V)*(e-n)/2+Math.sin(V)*(t-i)/2,d=-1*Math.sin(V)*(e-n)/2+Math.cos(V)*(t-i)/2,p=U*U/(l*l)+d*d/(h*h);p>1&&(l*=Math.sqrt(p),h*=Math.sqrt(p));var c=Math.sqrt((l*l*h*h-l*l*d*d-h*h*U*U)/(l*l*d*d+h*h*U*U));a===r&&(c*=-1),isNaN(c)&&(c=0);var u=c*l*d/h,y=c*-h*U/l,g=(e+n)/2+Math.cos(V)*u-Math.sin(V)*y,b=(t+i)/2+Math.sin(V)*u+Math.cos(V)*y,f=s([1,0],[(U-u)/l,(d-y)/h]),k=[(U-u)/l,(d-y)/h],_=[(-1*U-u)/l,(-1*d-y)/h],x=s(k,_);return o(k,_)<=-1&&(x=Math.PI),o(k,_)>=1&&(x=0),0===r&&x>0&&(x-=2*Math.PI),1===r&&0>x&&(x+=2*Math.PI),[g,b,l,h,f,x,V,r]},buildPath:function(e,t){var n=t.path,i=t.x||0,a=t.y||0;t.pathArray=t.pathArray||this.buildPathArray(n,i,a);for(var o=t.pathArray,s=t.pointList=[],r=[],l=0,h=o.length;h>l;l++){"M"==o[l].command.toUpperCase()&&(r.length>0&&s.push(r),r=[]);for(var m=o[l].points,V=0,U=m.length;U>V;V+=2)r.push([m[V],m[V+1]])}r.length>0&&s.push(r);for(var l=0,h=o.length;h>l;l++){var d=o[l].command,m=o[l].points;switch(d){case"L":e.lineTo(m[0],m[1]);break;case"M":e.moveTo(m[0],m[1]);break;case"C":e.bezierCurveTo(m[0],m[1],m[2],m[3],m[4],m[5]);break;case"Q":e.quadraticCurveTo(m[0],m[1],m[2],m[3]);break;case"A":var p=m[0],c=m[1],u=m[2],y=m[3],g=m[4],b=m[5],f=m[6],k=m[7],_=u>y?u:y,x=u>y?1:u/y,L=u>y?y/u:1;e.translate(p,c),e.rotate(f),e.scale(x,L),e.arc(0,0,_,g,g+b,1-k),e.scale(1/x,1/L),e.rotate(-f),e.translate(-p,-c);break;case"z":e.closePath()}}},getRect:function(e){if(e.__rect)return e.__rect;var t;t="stroke"==e.brushType||"fill"==e.brushType?e.lineWidth||1:0;for(var n=Number.MAX_VALUE,i=Number.MIN_VALUE,a=Number.MAX_VALUE,o=Number.MIN_VALUE,s=e.x||0,r=e.y||0,l=e.pathArray||this.buildPathArray(e.path),h=0;h<l.length;h++)for(var m=l[h].points,V=0;V<m.length;V++)V%2===0?(m[V]+s<n&&(n=m[V]),m[V]+s>i&&(i=m[V])):(m[V]+r<a&&(a=m[V]),m[V]+r>o&&(o=m[V]));var U;return U=n===Number.MAX_VALUE||i===Number.MIN_VALUE||a===Number.MAX_VALUE||o===Number.MIN_VALUE?{x:0,y:0,width:0,height:0}:{x:Math.round(n-t/2),y:Math.round(a-t/2),width:i-n+t,height:o-a+t},e.__rect=U,U}},e("../tool/util").inherits(r,t),r}),define("zrender/shape/Ellipse",["require","./Base","../tool/util"],function(e){var t=e("./Base"),n=function(e){t.call(this,e)};return n.prototype={type:"ellipse",buildPath:function(e,t){var n=.5522848,i=t.x,a=t.y,o=t.a,s=t.b,r=o*n,l=s*n;e.moveTo(i-o,a),e.bezierCurveTo(i-o,a-l,i-r,a-s,i,a-s),e.bezierCurveTo(i+r,a-s,i+o,a-l,i+o,a),e.bezierCurveTo(i+o,a+l,i+r,a+s,i,a+s),e.bezierCurveTo(i-r,a+s,i-o,a+l,i-o,a),e.closePath()},getRect:function(e){if(e.__rect)return e.__rect;var t;return t="stroke"==e.brushType||"fill"==e.brushType?e.lineWidth||1:0,e.__rect={x:Math.round(e.x-e.a-t/2),y:Math.round(e.y-e.b-t/2),width:2*e.a+t,height:2*e.b+t},e.__rect}},e("../tool/util").inherits(n,t),n}),define("echarts/component/dataRange",["require","./base","zrender/shape/Text","zrender/shape/Rectangle","../util/shape/HandlePolygon","../config","zrender/tool/util","zrender/tool/event","zrender/tool/area","zrender/tool/color","../component"],function(e){function t(e,t,i,a,o){if("undefined"==typeof this.query(a,"dataRange.min")||"undefined"==typeof this.query(a,"dataRange.max"))return void console.error("option.dataRange.min or option.dataRange.max has not been defined.");n.call(this,e,t,i,a,o);var r=this;r._ondrift=function(e,t){return r.__ondrift(this,e,t)},r._ondragend=function(){return r.__ondragend()},r._dataRangeSelected=function(e){return r.__dataRangeSelected(e)},r._dispatchHoverLink=function(e){return r.__dispatchHoverLink(e)},r._onhoverlink=function(e){return r.__onhoverlink(e)},this._selectedMap={},this._range={},this.refresh(a),t.bind(s.EVENT.HOVER,this._onhoverlink)}var n=e("./base"),i=e("zrender/shape/Text"),a=e("zrender/shape/Rectangle"),o=e("../util/shape/HandlePolygon"),s=e("../config"),r=e("zrender/tool/util"),l=e("zrender/tool/event"),h=e("zrender/tool/area"),m=e("zrender/tool/color");return t.prototype={type:s.COMPONENT_TYPE_DATARANGE,_textGap:10,_buildShape:function(){if(this._itemGroupLocation=this._getItemGroupLocation(),this._buildBackground(),this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable?this._buildGradient():this._buildItem(),this.dataRangeOption.show)for(var e=0,t=this.shapeList.length;t>e;e++)this.zr.addShape(this.shapeList[e]);this._syncShapeFromRange()},_buildItem:function(){var e,t,n,o,s=this._valueTextList,r=s.length,l=this.getFont(this.dataRangeOption.textStyle),m=this._itemGroupLocation.x,V=this._itemGroupLocation.y,U=this.dataRangeOption.itemWidth,d=this.dataRangeOption.itemHeight,p=this.dataRangeOption.itemGap,c=h.getTextHeight("国",l);"vertical"==this.dataRangeOption.orient&&"right"==this.dataRangeOption.x&&(m=this._itemGroupLocation.x+this._itemGroupLocation.width-U);var u=!0;this.dataRangeOption.text&&(u=!1,this.dataRangeOption.text[0]&&(n=this._getTextShape(m,V,this.dataRangeOption.text[0]),"horizontal"==this.dataRangeOption.orient?m+=h.getTextWidth(this.dataRangeOption.text[0],l)+this._textGap:(V+=c+this._textGap,n.style.y+=c/2+this._textGap,n.style.textBaseline="bottom"),this.shapeList.push(new i(n))));for(var y=0;r>y;y++)e=s[y],o=this.getColorByIndex(y),t=this._getItemShape(m,V,U,d,this._selectedMap[y]?o:"#ccc"),t._idx=y,t.onmousemove=this._dispatchHoverLink,t.onclick=this._dataRangeSelected,this.shapeList.push(new a(t)),u&&(n={zlevel:this._zlevelBase,style:{x:m+U+5,y:V,color:this._selectedMap[y]?this.dataRangeOption.textStyle.color:"#ccc",text:s[y],textFont:l,textBaseline:"top"},highlightStyle:{brushType:"fill"},clickable:!0},"vertical"==this.dataRangeOption.orient&&"right"==this.dataRangeOption.x&&(n.style.x-=U+10,n.style.textAlign="right"),n._idx=y,n.onclick=this._dataRangeSelected,this.shapeList.push(new i(n))),"horizontal"==this.dataRangeOption.orient?m+=U+(u?5:0)+(u?h.getTextWidth(e,l):0)+p:V+=d+p;!u&&this.dataRangeOption.text[1]&&("horizontal"==this.dataRangeOption.orient?m=m-p+this._textGap:V=V-p+this._textGap,n=this._getTextShape(m,V,this.dataRangeOption.text[1]),"horizontal"!=this.dataRangeOption.orient&&(n.style.y-=5,n.style.textBaseline="top"),this.shapeList.push(new i(n)))},_buildGradient:function(){var t,n,o=this.getFont(this.dataRangeOption.textStyle),s=this._itemGroupLocation.x,r=this._itemGroupLocation.y,l=this.dataRangeOption.itemWidth,m=this.dataRangeOption.itemHeight,V=h.getTextHeight("国",o),U=!0;this.dataRangeOption.text&&(U=!1,this.dataRangeOption.text[0]&&(n=this._getTextShape(s,r,this.dataRangeOption.text[0]),"horizontal"==this.dataRangeOption.orient?s+=h.getTextWidth(this.dataRangeOption.text[0],o)+this._textGap:(r+=V+this._textGap,n.style.y+=V/2+this._textGap,n.style.textBaseline="bottom"),this.shapeList.push(new i(n))));for(var d=e("zrender/tool/color"),p=1/(this.dataRangeOption.color.length-1),c=[],u=0,y=this.dataRangeOption.color.length;y>u;u++)c.push([u*p,this.dataRangeOption.color[u]]);"horizontal"==this.dataRangeOption.orient?(t={zlevel:this._zlevelBase,style:{x:s,y:r,width:10*l,height:m,color:d.getLinearGradient(s,r,s+10*l,r,c)},hoverable:!1},s+=10*l+this._textGap):(t={zlevel:this._zlevelBase,style:{x:s,y:r,width:l,height:10*m,color:d.getLinearGradient(s,r,s,r+10*m,c)},hoverable:!1},r+=10*m+this._textGap),this.shapeList.push(new a(t)),this._calculableLocation=t.style,this.dataRangeOption.calculable&&(this._buildFiller(),this._bulidMask(),this._bulidHandle()),this._buildIndicator(),!U&&this.dataRangeOption.text[1]&&(n=this._getTextShape(s,r,this.dataRangeOption.text[1]),this.shapeList.push(new i(n)))},_buildIndicator:function(){var e,t,n=this._calculableLocation.x,i=this._calculableLocation.y,a=this._calculableLocation.width,s=this._calculableLocation.height,r=5;"horizontal"==this.dataRangeOption.orient?"bottom"!=this.dataRangeOption.y?(e=[[n,i+s],[n-r,i+s+r],[n+r,i+s+r]],t="bottom"):(e=[[n,i],[n-r,i-r],[n+r,i-r]],t="top"):"right"!=this.dataRangeOption.x?(e=[[n+a,i],[n+a+r,i-r],[n+a+r,i+r]],t="right"):(e=[[n,i],[n-r,i-r],[n-r,i+r]],t="left"),this._indicatorShape={style:{pointList:e,color:"#fff",__rect:{x:Math.min(e[0][0],e[1][0]),y:Math.min(e[0][1],e[1][1]),width:r*("horizontal"==this.dataRangeOption.orient?2:1),height:r*("horizontal"==this.dataRangeOption.orient?1:2)}},highlightStyle:{brushType:"fill",textPosition:t,textColor:this.dataRangeOption.textStyle.color},hoverable:!1},this._indicatorShape=new o(this._indicatorShape)},_buildFiller:function(){this._fillerShape={zlevel:this._zlevelBase+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 a(this._fillerShape),this.shapeList.push(this._fillerShape)},_bulidHandle:function(){var e,t,n,i,a,s,r,l,m=this._calculableLocation.x,V=this._calculableLocation.y,U=this._calculableLocation.width,d=this._calculableLocation.height,p=this.getFont(this.dataRangeOption.textStyle),c=h.getTextHeight("国",p),u=Math.max(h.getTextWidth(this._textFormat(this.dataRangeOption.max),p),h.getTextWidth(this._textFormat(this.dataRangeOption.min),p))+2;
"horizontal"==this.dataRangeOption.orient?"bottom"!=this.dataRangeOption.y?(e=[[m,V],[m,V+d+c],[m-c,V+d+c],[m-1,V+d],[m-1,V]],t=m-u/2-c,n=V+d+c/2+2,i={x:m-u-c,y:V+d,width:u+c,height:c},a=[[m+U,V],[m+U,V+d+c],[m+U+c,V+d+c],[m+U+1,V+d],[m+U+1,V]],s=m+U+u/2+c,r=n,l={x:m+U,y:V+d,width:u+c,height:c}):(e=[[m,V+d],[m,V-c],[m-c,V-c],[m-1,V],[m-1,V+d]],t=m-u/2-c,n=V-c/2-2,i={x:m-u-c,y:V-c,width:u+c,height:c},a=[[m+U,V+d],[m+U,V-c],[m+U+c,V-c],[m+U+1,V],[m+U+1,V+d]],s=m+U+u/2+c,r=n,l={x:m+U,y:V-c,width:u+c,height:c}):(u+=c,"right"!=this.dataRangeOption.x?(e=[[m,V],[m+U+c,V],[m+U+c,V-c],[m+U,V-1],[m,V-1]],t=m+U+u/2+c/2,n=V-c/2,i={x:m+U,y:V-c,width:u+c,height:c},a=[[m,V+d],[m+U+c,V+d],[m+U+c,V+c+d],[m+U,V+1+d],[m,V+d+1]],s=t,r=V+d+c/2,l={x:m+U,y:V+d,width:u+c,height:c}):(e=[[m+U,V],[m-c,V],[m-c,V-c],[m,V-1],[m+U,V-1]],t=m-u/2-c/2,n=V-c/2,i={x:m-u-c,y:V-c,width:u+c,height:c},a=[[m+U,V+d],[m-c,V+d],[m-c,V+c+d],[m,V+1+d],[m+U,V+d+1]],s=t,r=V+d+c/2,l={x:m-u-c,y:V+d,width:u+c,height:c})),this._startShape={style:{pointList:e,text:this._textFormat(this.dataRangeOption.max),textX:t,textY:n,color:this.getColor(this.dataRangeOption.max),rect:i,x:e[0][0],y:e[0][1],_x:e[0][0],_y:e[0][1]}},this._startShape.highlightStyle={strokeColor:this._startShape.style.color,lineWidth:1},this._endShape={style:{pointList:a,text:this._textFormat(this.dataRangeOption.min),textX:s,textY:r,color:this.getColor(this.dataRangeOption.min),rect:l,x:a[0][0],y:a[0][1],_x:a[0][0],_y:a[0][1]}},this._endShape.highlightStyle={strokeColor:this._endShape.style.color,lineWidth:1},this._startShape.zlevel=this._endShape.zlevel=this._zlevelBase+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 o(this._startShape),this._endShape=new o(this._endShape),this.shapeList.push(this._startShape),this.shapeList.push(this._endShape)},_bulidMask:function(){var e=this._calculableLocation.x,t=this._calculableLocation.y,n=this._calculableLocation.width,i=this._calculableLocation.height;this._startMask={zlevel:this._zlevelBase+1,style:{x:e,y:t,width:"horizontal"==this.dataRangeOption.orient?0:n,height:"horizontal"==this.dataRangeOption.orient?i:0,color:"#ccc"},hoverable:!1},this._endMask={zlevel:this._zlevelBase+1,style:{x:"horizontal"==this.dataRangeOption.orient?e+n:e,y:"horizontal"==this.dataRangeOption.orient?t:t+i,width:"horizontal"==this.dataRangeOption.orient?0:n,height:"horizontal"==this.dataRangeOption.orient?i:0,color:"#ccc"},hoverable:!1},this._startMask=new a(this._startMask),this._endMask=new a(this._endMask),this.shapeList.push(this._startMask),this.shapeList.push(this._endMask)},_buildBackground:function(){var e=this.reformCssArray(this.dataRangeOption.padding);this.shapeList.push(new a({zlevel:this._zlevelBase,hoverable:!1,style:{x:this._itemGroupLocation.x-e[3],y:this._itemGroupLocation.y-e[0],width:this._itemGroupLocation.width+e[3]+e[1],height:this._itemGroupLocation.height+e[0]+e[2],brushType:0===this.dataRangeOption.borderWidth?"fill":"both",color:this.dataRangeOption.backgroundColor,strokeColor:this.dataRangeOption.borderColor,lineWidth:this.dataRangeOption.borderWidth}}))},_getItemGroupLocation:function(){var e=this._valueTextList,t=e.length,n=this.dataRangeOption.itemGap,i=this.dataRangeOption.itemWidth,a=this.dataRangeOption.itemHeight,o=0,s=0,r=this.getFont(this.dataRangeOption.textStyle),l=h.getTextHeight("国",r);if("horizontal"==this.dataRangeOption.orient){if(this.dataRangeOption.text||this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable)o=(this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable?10*i+n:t*(i+n))+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[0]?h.getTextWidth(this.dataRangeOption.text[0],r)+this._textGap:0)+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[1]?h.getTextWidth(this.dataRangeOption.text[1],r)+this._textGap:0);else{i+=5;for(var m=0;t>m;m++)o+=i+h.getTextWidth(e[m],r)+n}o-=n,s=Math.max(l,a)}else{var V;if(this.dataRangeOption.text||this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable)s=(this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable?10*a+n:t*(a+n))+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[0]?this._textGap+l:0)+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[1]?this._textGap+l:0),V=Math.max(h.getTextWidth(this.dataRangeOption.text&&this.dataRangeOption.text[0]||"",r),h.getTextWidth(this.dataRangeOption.text&&this.dataRangeOption.text[1]||"",r)),o=Math.max(i,V);else{s=(a+n)*t,i+=5,V=0;for(var m=0;t>m;m++)V=Math.max(V,h.getTextWidth(e[m],r));o=i+V}s-=n}var U,d=this.reformCssArray(this.dataRangeOption.padding),p=this.zr.getWidth();switch(this.dataRangeOption.x){case"center":U=Math.floor((p-o)/2);break;case"left":U=d[3]+this.dataRangeOption.borderWidth;break;case"right":U=p-o-d[1]-this.dataRangeOption.borderWidth;break;default:U=this.parsePercent(this.dataRangeOption.x,p),U=isNaN(U)?0:U}var c,u=this.zr.getHeight();switch(this.dataRangeOption.y){case"top":c=d[0]+this.dataRangeOption.borderWidth;break;case"bottom":c=u-s-d[2]-this.dataRangeOption.borderWidth;break;case"center":c=Math.floor((u-s)/2);break;default:c=this.parsePercent(this.dataRangeOption.y,u),c=isNaN(c)?0:c}if(this.dataRangeOption.calculable){var y=Math.max(h.getTextWidth(this.dataRangeOption.max,r),h.getTextWidth(this.dataRangeOption.min,r))+l;"horizontal"==this.dataRangeOption.orient?(y>U&&(U=y),U+o+y>p&&(U-=y)):(l>c&&(c=l),c+s+l>u&&(c-=l))}return{x:U,y:c,width:o,height:s}},_getTextShape:function(e,t,n){return{zlevel:this._zlevelBase,style:{x:"horizontal"==this.dataRangeOption.orient?e:this._itemGroupLocation.x+this._itemGroupLocation.width/2,y:"horizontal"==this.dataRangeOption.orient?this._itemGroupLocation.y+this._itemGroupLocation.height/2:t,color:this.dataRangeOption.textStyle.color,text:n,textFont:this.getFont(this.dataRangeOption.textStyle),textBaseline:"horizontal"==this.dataRangeOption.orient?"middle":"top",textAlign:"horizontal"==this.dataRangeOption.orient?"left":"center"},hoverable:!1}},_getItemShape:function(e,t,n,i,a){return{zlevel:this._zlevelBase,style:{x:e,y:t+1,width:n,height:i-2,color:a},highlightStyle:{strokeColor:a,lineWidth:1},clickable:!0}},__ondrift:function(e,t,n){var i=this._calculableLocation.x,a=this._calculableLocation.y,o=this._calculableLocation.width,s=this._calculableLocation.height;return"horizontal"==this.dataRangeOption.orient?e.style.x+t<=i?e.style.x=i:e.style.x+t+e.style.width>=i+o?e.style.x=i+o-e.style.width:e.style.x+=t:e.style.y+n<=a?e.style.y=a:e.style.y+n+e.style.height>=a+s?e.style.y=a+s-e.style.height:e.style.y+=n,"filler"==e._type?this._syncHandleShape():this._syncFillerShape(e),this.dataRangeOption.realtime&&this._syncData(),!0},__ondragend:function(){this.isDragend=!0},ondragend:function(e,t){this.isDragend&&e.target&&(!this.dataRangeOption.realtime&&this._syncData(),t.dragOut=!0,t.dragIn=!0,this.dataRangeOption.realtime||this.messageCenter.dispatch(s.EVENT.DATA_RANGE,null,{range:{start:this._range.end,end:this._range.start}},this.myChart),t.needRefresh=!1,this.isDragend=!1)},_syncShapeFromRange:function(){var e=this.dataRangeOption.range||{};if(this._range.end="undefined"!=typeof this._range.end?this._range.end:"undefined"!=typeof e.start?e.start:0,this._range.start="undefined"!=typeof this._range.start?this._range.start:"undefined"!=typeof e.end?e.end:100,100!=this._range.start||0!==this._range.end){if("horizontal"==this.dataRangeOption.orient){var t=this._fillerShape.style.width;this._fillerShape.style.x+=t*(100-this._range.start)/100,this._fillerShape.style.width=t*(this._range.start-this._range.end)/100}else{var n=this._fillerShape.style.height;this._fillerShape.style.y+=n*(100-this._range.start)/100,this._fillerShape.style.height=n*(this._range.start-this._range.end)/100}this.zr.modShape(this._fillerShape.id),this._syncHandleShape()}},_syncHandleShape:function(){var e=this._calculableLocation.x,t=this._calculableLocation.y,n=this._calculableLocation.width,i=this._calculableLocation.height;"horizontal"==this.dataRangeOption.orient?(this._startShape.style.x=this._fillerShape.style.x,this._startMask.style.width=this._startShape.style.x-e,this._endShape.style.x=this._fillerShape.style.x+this._fillerShape.style.width,this._endMask.style.x=this._endShape.style.x,this._endMask.style.width=e+n-this._endShape.style.x,this._range.start=Math.ceil(100-(this._startShape.style.x-e)/n*100),this._range.end=Math.floor(100-(this._endShape.style.x-e)/n*100)):(this._startShape.style.y=this._fillerShape.style.y,this._startMask.style.height=this._startShape.style.y-t,this._endShape.style.y=this._fillerShape.style.y+this._fillerShape.style.height,this._endMask.style.y=this._endShape.style.y,this._endMask.style.height=t+i-this._endShape.style.y,this._range.start=Math.ceil(100-(this._startShape.style.y-t)/i*100),this._range.end=Math.floor(100-(this._endShape.style.y-t)/i*100)),this._syncShape()},_syncFillerShape:function(e){var t,n,i=this._calculableLocation.x,a=this._calculableLocation.y,o=this._calculableLocation.width,s=this._calculableLocation.height;"horizontal"==this.dataRangeOption.orient?(t=this._startShape.style.x,n=this._endShape.style.x,e.id==this._startShape.id&&t>=n?(n=t,this._endShape.style.x=t):e.id==this._endShape.id&&t>=n&&(t=n,this._startShape.style.x=t),this._fillerShape.style.x=t,this._fillerShape.style.width=n-t,this._startMask.style.width=t-i,this._endMask.style.x=n,this._endMask.style.width=i+o-n,this._range.start=Math.ceil(100-(t-i)/o*100),this._range.end=Math.floor(100-(n-i)/o*100)):(t=this._startShape.style.y,n=this._endShape.style.y,e.id==this._startShape.id&&t>=n?(n=t,this._endShape.style.y=t):e.id==this._endShape.id&&t>=n&&(t=n,this._startShape.style.y=t),this._fillerShape.style.y=t,this._fillerShape.style.height=n-t,this._startMask.style.height=t-a,this._endMask.style.y=n,this._endMask.style.height=a+s-n,this._range.start=Math.ceil(100-(t-a)/s*100),this._range.end=Math.floor(100-(n-a)/s*100)),this._syncShape()},_syncShape:function(){this._startShape.position=[this._startShape.style.x-this._startShape.style._x,this._startShape.style.y-this._startShape.style._y],this._startShape.style.text=this._textFormat(this._gap*this._range.start+this.dataRangeOption.min),this._startShape.style.color=this._startShape.highlightStyle.strokeColor=this.getColor(this._gap*this._range.start+this.dataRangeOption.min),this._endShape.position=[this._endShape.style.x-this._endShape.style._x,this._endShape.style.y-this._endShape.style._y],this._endShape.style.text=this._textFormat(this._gap*this._range.end+this.dataRangeOption.min),this._endShape.style.color=this._endShape.highlightStyle.strokeColor=this.getColor(this._gap*this._range.end+this.dataRangeOption.min),this.zr.modShape(this._startShape.id),this.zr.modShape(this._endShape.id),this.zr.modShape(this._startMask.id),this.zr.modShape(this._endMask.id),this.zr.modShape(this._fillerShape.id),this.zr.refresh()},_syncData:function(){this.dataRangeOption.realtime&&this.messageCenter.dispatch(s.EVENT.DATA_RANGE,null,{range:{start:this._range.end,end:this._range.start}},this.myChart)},__dataRangeSelected:function(e){var t=e.target._idx;this._selectedMap[t]=!this._selectedMap[t],this.messageCenter.dispatch(s.EVENT.REFRESH,null,null,this.myChart)},__dispatchHoverLink:function(e){var t,n;if(this.dataRangeOption.calculable){var i,a=this.dataRangeOption.max-this.dataRangeOption.min;i="horizontal"==this.dataRangeOption.orient?(1-(l.getX(e.event)-this._calculableLocation.x)/this._calculableLocation.width)*a:(1-(l.getY(e.event)-this._calculableLocation.y)/this._calculableLocation.height)*a,t=i-.05*a,n=i+.05*a}else{var o=e.target._idx;n=(this._colorList.length-o)*this._gap+this.dataRangeOption.min,t=n-this._gap}this.messageCenter.dispatch(s.EVENT.DATA_RANGE_HOVERLINK,e.event,{valueMin:t,valueMax:n},this.myChart)},__onhoverlink:function(e){if(this.dataRangeOption.show&&this.dataRangeOption.hoverLink&&this._indicatorShape&&e&&null!=e.seriesIndex&&null!=e.dataIndex){var t=e.value;if(isNaN(t))return;t<this.dataRangeOption.min?t=this.dataRangeOption.min:t>this.dataRangeOption.max&&(t=this.dataRangeOption.max),this._indicatorShape.position="horizontal"==this.dataRangeOption.orient?[(this.dataRangeOption.max-t)/(this.dataRangeOption.max-this.dataRangeOption.min)*this._calculableLocation.width,0]:[0,(this.dataRangeOption.max-t)/(this.dataRangeOption.max-this.dataRangeOption.min)*this._calculableLocation.height],this._indicatorShape.style.text=e.value,this._indicatorShape.style.color=this.getColor(t),this.zr.addHoverShape(this._indicatorShape)}},_textFormat:function(e,t){if(e=e.toFixed(this.dataRangeOption.precision),t="undefined"!=typeof t?t.toFixed(this.dataRangeOption.precision):"",this.dataRangeOption.formatter){if("string"==typeof this.dataRangeOption.formatter)return this.dataRangeOption.formatter.replace("{value}",e).replace("{value2}",t);if("function"==typeof this.dataRangeOption.formatter)return this.dataRangeOption.formatter.call(this.myChart,e,t)}return""!==t?e+" - "+t:e},refresh:function(e){if(e){this.option=e,this.option.dataRange=this.reformOption(this.option.dataRange),this.dataRangeOption=this.option.dataRange,this.myChart.canvasSupported||(this.dataRangeOption.realtime=!1);var t=this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable?100:this.dataRangeOption.splitNumber;if(this._colorList=m.getGradientColors(this.dataRangeOption.color,Math.max((t-this.dataRangeOption.color.length)/(this.dataRangeOption.color.length-1),0)+1),this._colorList.length>t){for(var n=this._colorList.length,i=[this._colorList[0]],a=n/(t-1),o=1;t-1>o;o++)i.push(this._colorList[Math.floor(o*a)]);i.push(this._colorList[n-1]),this._colorList=i}var s=this.dataRangeOption.precision;for(this._gap=(this.dataRangeOption.max-this.dataRangeOption.min)/t;this._gap.toFixed(s)-0!=this._gap&&5>s;)s++;this.dataRangeOption.precision=s,this._gap=((this.dataRangeOption.max-this.dataRangeOption.min)/t).toFixed(s)-0,this._valueTextList=[];for(var o=0;t>o;o++)this._selectedMap[o]=!0,this._valueTextList.unshift(this._textFormat(o*this._gap+this.dataRangeOption.min,(o+1)*this._gap+this.dataRangeOption.min))}this.clear(),this._buildShape()},getColor:function(e){if(isNaN(e))return null;if(this.dataRangeOption.min==this.dataRangeOption.max)return this._colorList[0];if(e<this.dataRangeOption.min?e=this.dataRangeOption.min:e>this.dataRangeOption.max&&(e=this.dataRangeOption.max),this.dataRangeOption.calculable&&(e-(this._gap*this._range.start+this.dataRangeOption.min)>5e-5||e-(this._gap*this._range.end+this.dataRangeOption.min)<-5e-5))return null;var t=this._colorList.length-Math.ceil((e-this.dataRangeOption.min)/(this.dataRangeOption.max-this.dataRangeOption.min)*this._colorList.length);return t==this._colorList.length&&t--,this._selectedMap[t]?this._colorList[t]:null},getColorByIndex:function(e){return e>=this._colorList.length?e=this._colorList.length-1:0>e&&(e=0),this._colorList[e]},onbeforDispose:function(){this.messageCenter.unbind(s.EVENT.HOVER,this._onhoverlink)}},r.inherits(t,n),e("../component").define("dataRange",t),t}),define("echarts/component/roamController",["require","./base","zrender/shape/Rectangle","zrender/shape/Sector","zrender/shape/Circle","../config","zrender/tool/util","zrender/tool/color","zrender/tool/event","../component"],function(e){function t(e,t,i,a,o){if(a.roamController&&a.roamController.show){if(!a.roamController.mapTypeControl)return void console.error("option.roamController.mapTypeControl has not been defined.");n.call(this,e,t,i,a,o),this.rcOption=a.roamController;var s=this;this._drictionMouseDown=function(e){return s.__drictionMouseDown(e)},this._drictionMouseUp=function(e){return s.__drictionMouseUp(e)},this._drictionMouseMove=function(e){return s.__drictionMouseMove(e)},this._drictionMouseOut=function(e){return s.__drictionMouseOut(e)},this._scaleHandler=function(e){return s.__scaleHandler(e)},this.refresh(a)}}var n=e("./base"),i=e("zrender/shape/Rectangle"),a=e("zrender/shape/Sector"),o=e("zrender/shape/Circle"),s=e("../config"),r=e("zrender/tool/util"),l=e("zrender/tool/color"),h=e("zrender/tool/event");return t.prototype={type:s.COMPONENT_TYPE_ROAMCONTROLLER,_buildShape:function(){if(this.rcOption.show){this._itemGroupLocation=this._getItemGroupLocation(),this._buildBackground(),this._buildItem();for(var e=0,t=this.shapeList.length;t>e;e++)this.zr.addShape(this.shapeList[e])}},_buildItem:function(){this.shapeList.push(this._getDirectionShape("up")),this.shapeList.push(this._getDirectionShape("down")),this.shapeList.push(this._getDirectionShape("left")),this.shapeList.push(this._getDirectionShape("right")),this.shapeList.push(this._getScaleShape("scaleUp")),this.shapeList.push(this._getScaleShape("scaleDown"))},_getDirectionShape:function(e){var t=this._itemGroupLocation.r,n=this._itemGroupLocation.x+t,i=this._itemGroupLocation.y+t,o={zlevel:this._zlevelBase,style:{x:n,y:i,r:t,startAngle:-45,endAngle:45,color:this.rcOption.handleColor,text:">",textX:n+t/2+4,textY:i-.5,textAlign:"center",textBaseline:"middle",textPosition:"specific",textColor:this.rcOption.fillerColor,textFont:Math.floor(t/2)+"px arial"},highlightStyle:{color:l.lift(this.r