scatter.js 80 KB

123
  1. define("echarts/chart/scatter",["require","./base","../util/shape/Symbol","../component/axis","../component/grid","../component/dataZoom","../component/dataRange","../config","zrender/tool/util","zrender/tool/color","../chart"],function(t){function e(t,e,s,o,n){i.call(this,t,e,s,o,n),this.refresh(o)}var i=t("./base"),s=t("../util/shape/Symbol");t("../component/axis"),t("../component/grid"),t("../component/dataZoom"),t("../component/dataRange");var o=t("../config");o.scatter={zlevel:0,z:2,clickable:!0,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbolSize:4,large:!1,largeThreshold:2e3,itemStyle:{normal:{label:{show:!1}},emphasis:{label:{show:!1}}}};var n=t("zrender/tool/util"),a=t("zrender/tool/color");return e.prototype={type:o.CHART_TYPE_SCATTER,_buildShape:function(){var t=this.series;this._sIndex2ColorMap={},this._symbol=this.option.symbolList,this._sIndex2ShapeMap={},this.selectedMap={},this.xMarkMap={};for(var e,i,s,n,r=this.component.legend,h=[],l=0,d=t.length;d>l;l++)if(e=t[l],i=e.name,e.type===o.CHART_TYPE_SCATTER){if(t[l]=this.reformOption(t[l]),this.legendHoverLink=t[l].legendHoverLink||this.legendHoverLink,this._sIndex2ShapeMap[l]=this.query(e,"symbol")||this._symbol[l%this._symbol.length],r){if(this.selectedMap[i]=r.isSelected(i),this._sIndex2ColorMap[l]=a.alpha(r.getColor(i),.5),s=r.getItemShape(i)){var n=this._sIndex2ShapeMap[l];s.style.brushType=n.match("empty")?"stroke":"both",n=n.replace("empty","").toLowerCase(),n.match("rectangle")&&(s.style.x+=Math.round((s.style.width-s.style.height)/2),s.style.width=s.style.height),n.match("star")&&(s.style.n=n.replace("star","")-0||5,n="star"),n.match("image")&&(s.style.image=n.replace(new RegExp("^image:\\/\\/"),""),s.style.x+=Math.round((s.style.width-s.style.height)/2),s.style.width=s.style.height,n="image"),s.style.iconType=n,r.setItemShape(i,s)}}else this.selectedMap[i]=!0,this._sIndex2ColorMap[l]=a.alpha(this.zr.getColor(l),.5);this.selectedMap[i]&&h.push(l)}this._buildSeries(h),this.addShapeList()},_buildSeries:function(t){if(0!==t.length){for(var e,i,s,o,n,a,r,h,l=this.series,d={},c=0,p=t.length;p>c;c++)if(e=t[c],i=l[e],0!==i.data.length){n=this.component.xAxis.getAxis(i.xAxisIndex||0),a=this.component.yAxis.getAxis(i.yAxisIndex||0),d[e]=[];for(var u=0,g=i.data.length;g>u;u++)s=i.data[u],o=this.getDataFromOption(s,"-"),"-"===o||o.length<2||(r=n.getCoord(o[0]),h=a.getCoord(o[1]),d[e].push([r,h,u,s.name||""]));this.xMarkMap[e]=this._markMap(n,a,i.data,d[e]),this.buildMark(e)}this._buildPointList(d)}},_markMap:function(t,e,i,s){for(var o,n={min0:Number.POSITIVE_INFINITY,max0:Number.NEGATIVE_INFINITY,sum0:0,counter0:0,average0:0,min1:Number.POSITIVE_INFINITY,max1:Number.NEGATIVE_INFINITY,sum1:0,counter1:0,average1:0},a=0,r=s.length;r>a;a++)o=i[s[a][2]].value||i[s[a][2]],n.min0>o[0]&&(n.min0=o[0],n.minY0=s[a][1],n.minX0=s[a][0]),n.max0<o[0]&&(n.max0=o[0],n.maxY0=s[a][1],n.maxX0=s[a][0]),n.sum0+=o[0],n.counter0++,n.min1>o[1]&&(n.min1=o[1],n.minY1=s[a][1],n.minX1=s[a][0]),n.max1<o[1]&&(n.max1=o[1],n.maxY1=s[a][1],n.maxX1=s[a][0]),n.sum1+=o[1],n.counter1++;var h=this.component.grid.getX(),l=this.component.grid.getXend(),d=this.component.grid.getY(),c=this.component.grid.getYend();n.average0=n.sum0/n.counter0;var p=t.getCoord(n.average0);n.averageLine0=[[p,c],[p,d]],n.minLine0=[[n.minX0,c],[n.minX0,d]],n.maxLine0=[[n.maxX0,c],[n.maxX0,d]],n.average1=n.sum1/n.counter1;var u=e.getCoord(n.average1);return n.averageLine1=[[h,u],[l,u]],n.minLine1=[[h,n.minY1],[l,n.minY1]],n.maxLine1=[[h,n.maxY1],[l,n.maxY1]],n},_buildPointList:function(t){var e,i,s,o,n=this.series;for(var a in t)if(e=n[a],i=t[a],e.large&&e.data.length>e.largeThreshold)this.shapeList.push(this._getLargeSymbol(i,this.getItemStyleColor(this.query(e,"itemStyle.normal.color"),a,-1)||this._sIndex2ColorMap[a]));else for(var r=0,h=i.length;h>r;r++)s=i[r],o=this._getSymbol(a,s[2],s[3],s[0],s[1]),o&&this.shapeList.push(o)},_getSymbol:function(t,e,i,s,o){var n,a=this.series,r=a[t],h=r.data[e],l=this.component.dataRange;if(l){if(n=isNaN(h[2])?this._sIndex2ColorMap[t]:l.getColor(h[2]),!n)return null}else n=this._sIndex2ColorMap[t];var d=this.getSymbolShape(r,t,h,e,i,s,o,this._sIndex2ShapeMap[t],n,"rgba(0,0,0,0)","vertical");return d.zlevel=this.getZlevelBase(),d.z=this.getZBase(),d._main=!0,d},_getLargeSymbol:function(t,e){return new s({zlevel:this.getZlevelBase(),z:this.getZBase(),_main:!0,hoverable:!1,style:{pointList:t,color:e,strokeColor:e},highlightStyle:{pointList:[]}})},getMarkCoord:function(t,e){var i,s=this.series[t],o=this.xMarkMap[t],n=this.component.xAxis.getAxis(s.xAxisIndex),a=this.component.yAxis.getAxis(s.yAxisIndex);if(!e.type||"max"!==e.type&&"min"!==e.type&&"average"!==e.type)i=["string"!=typeof e.xAxis&&n.getCoordByIndex?n.getCoordByIndex(e.xAxis||0):n.getCoord(e.xAxis||0),"string"!=typeof e.yAxis&&a.getCoordByIndex?a.getCoordByIndex(e.yAxis||0):a.getCoord(e.yAxis||0)];else{var r=null!=e.valueIndex?e.valueIndex:1;i=[o[e.type+"X"+r],o[e.type+"Y"+r],o[e.type+"Line"+r],o[e.type+r]]}return i},refresh:function(t){t&&(this.option=t,this.series=t.series),this.backupShapeList(),this._buildShape()},ondataRange:function(t,e){this.component.dataRange&&(this.refresh(),e.needRefresh=!0)}},n.inherits(e,i),t("../chart").define("scatter",e),e}),define("echarts/component/axis",["require","./base","zrender/shape/Line","../config","../util/ecData","zrender/tool/util","zrender/tool/color","./categoryAxis","./valueAxis","../component"],function(t){function e(t,e,s,o,n,a){i.call(this,t,e,s,o,n),this.axisType=a,this._axisList=[],this.refresh(o)}var i=t("./base"),s=t("zrender/shape/Line"),o=t("../config"),n=t("../util/ecData"),a=t("zrender/tool/util"),r=t("zrender/tool/color");return e.prototype={type:o.COMPONENT_TYPE_AXIS,axisBase:{_buildAxisLine:function(){var t=this.option.axisLine.lineStyle.width,e=t/2,i={_axisShape:"axisLine",zlevel:this.getZlevelBase(),z:this.getZBase()+3,hoverable:!1},o=this.grid;switch(this.option.position){case"left":i.style={xStart:o.getX()-e,yStart:o.getYend(),xEnd:o.getX()-e,yEnd:o.getY(),lineCap:"round"};break;case"right":i.style={xStart:o.getXend()+e,yStart:o.getYend(),xEnd:o.getXend()+e,yEnd:o.getY(),lineCap:"round"};break;case"bottom":i.style={xStart:o.getX(),yStart:o.getYend()+e,xEnd:o.getXend(),yEnd:o.getYend()+e,lineCap:"round"};break;case"top":i.style={xStart:o.getX(),yStart:o.getY()-e,xEnd:o.getXend(),yEnd:o.getY()-e,lineCap:"round"}}var n=i.style;""!==this.option.name&&(n.text=this.option.name,n.textPosition=this.option.nameLocation,n.textFont=this.getFont(this.option.nameTextStyle),this.option.nameTextStyle.align&&(n.textAlign=this.option.nameTextStyle.align),this.option.nameTextStyle.baseline&&(n.textBaseline=this.option.nameTextStyle.baseline),this.option.nameTextStyle.color&&(n.textColor=this.option.nameTextStyle.color)),n.strokeColor=this.option.axisLine.lineStyle.color,n.lineWidth=t,this.isHorizontal()?n.yStart=n.yEnd=this.subPixelOptimize(n.yEnd,t):n.xStart=n.xEnd=this.subPixelOptimize(n.xEnd,t),n.lineType=this.option.axisLine.lineStyle.type,i=new s(i),this.shapeList.push(i)},_axisLabelClickable:function(t,e){return t?(n.pack(e,void 0,-1,void 0,-1,e.style.text),e.hoverable=!0,e.clickable=!0,e.highlightStyle={color:r.lift(e.style.color,1),brushType:"fill"},e):e},refixAxisShape:function(t,e){if(this.option.axisLine.onZero){var i;if(this.isHorizontal()&&null!=e)for(var s=0,o=this.shapeList.length;o>s;s++)"axisLine"===this.shapeList[s]._axisShape?(this.shapeList[s].style.yStart=this.shapeList[s].style.yEnd=this.subPixelOptimize(e,this.shapeList[s].stylelineWidth),this.zr.modShape(this.shapeList[s].id)):"axisTick"===this.shapeList[s]._axisShape&&(i=this.shapeList[s].style.yEnd-this.shapeList[s].style.yStart,this.shapeList[s].style.yStart=e-i,this.shapeList[s].style.yEnd=e,this.zr.modShape(this.shapeList[s].id));if(!this.isHorizontal()&&null!=t)for(var s=0,o=this.shapeList.length;o>s;s++)"axisLine"===this.shapeList[s]._axisShape?(this.shapeList[s].style.xStart=this.shapeList[s].style.xEnd=this.subPixelOptimize(t,this.shapeList[s].stylelineWidth),this.zr.modShape(this.shapeList[s].id)):"axisTick"===this.shapeList[s]._axisShape&&(i=this.shapeList[s].style.xEnd-this.shapeList[s].style.xStart,this.shapeList[s].style.xStart=t,this.shapeList[s].style.xEnd=t+i,this.zr.modShape(this.shapeList[s].id))}},getPosition:function(){return this.option.position},isHorizontal:function(){return"bottom"===this.option.position||"top"===this.option.position}},reformOption:function(t){if(!t||t instanceof Array&&0===t.length?t=[{type:o.COMPONENT_TYPE_AXIS_VALUE}]:t instanceof Array||(t=[t]),t.length>2&&(t=[t[0],t[1]]),"xAxis"===this.axisType){(!t[0].position||"bottom"!=t[0].position&&"top"!=t[0].position)&&(t[0].position="bottom"),t.length>1&&(t[1].position="bottom"===t[0].position?"top":"bottom");for(var e=0,i=t.length;i>e;e++)t[e].type=t[e].type||"category",t[e].xAxisIndex=e,t[e].yAxisIndex=-1}else{(!t[0].position||"left"!=t[0].position&&"right"!=t[0].position)&&(t[0].position="left"),t.length>1&&(t[1].position="left"===t[0].position?"right":"left");for(var e=0,i=t.length;i>e;e++)t[e].type=t[e].type||"value",t[e].xAxisIndex=-1,t[e].yAxisIndex=e}return t},refresh:function(e){var i;e&&(this.option=e,"xAxis"===this.axisType?(this.option.xAxis=this.reformOption(e.xAxis),i=this.option.xAxis):(this.option.yAxis=this.reformOption(e.yAxis),i=this.option.yAxis),this.series=e.series);for(var s=t("./categoryAxis"),o=t("./valueAxis"),n=Math.max(i&&i.length||0,this._axisList.length),a=0;n>a;a++)!this._axisList[a]||!e||i[a]&&this._axisList[a].type==i[a].type||(this._axisList[a].dispose&&this._axisList[a].dispose(),this._axisList[a]=!1),this._axisList[a]?this._axisList[a].refresh&&this._axisList[a].refresh(i?i[a]:!1,this.series):i&&i[a]&&(this._axisList[a]="category"===i[a].type?new s(this.ecTheme,this.messageCenter,this.zr,i[a],this.myChart,this.axisBase):new o(this.ecTheme,this.messageCenter,this.zr,i[a],this.myChart,this.axisBase,this.series))},getAxis:function(t){return this._axisList[t]},clear:function(){for(var t=0,e=this._axisList.length;e>t;t++)this._axisList[t].dispose&&this._axisList[t].dispose();this._axisList=[]}},a.inherits(e,i),t("../component").define("axis",e),e}),define("echarts/component/grid",["require","./base","zrender/shape/Rectangle","../config","zrender/tool/util","../component"],function(t){function e(t,e,s,o,n){i.call(this,t,e,s,o,n),this.refresh(o)}var i=t("./base"),s=t("zrender/shape/Rectangle"),o=t("../config");o.grid={zlevel:0,z:0,x:12,y:60,x2:12,y2:60,backgroundColor:"rgba(0,0,0,0)",borderWidth:0,borderColor:"#ccc"};var n=t("zrender/tool/util");return e.prototype={type:o.COMPONENT_TYPE_GRID,getX:function(){return this._x},getY:function(){return this._y},getWidth:function(){return this._width},getHeight:function(){return this._height},getXend:function(){return this._x+this._width},getYend:function(){return this._y+this._height},getArea:function(){return{x:this._x,y:this._y,width:this._width,height:this._height}},getBbox:function(){return[[this._x,this._y],[this.getXend(),this.getYend()]]},refixAxisShape:function(t){for(var e,i,s,n=t.xAxis._axisList.concat(t.yAxis?t.yAxis._axisList:[]),a=n.length;a--;)s=n[a],s.type==o.COMPONENT_TYPE_AXIS_VALUE&&s._min<0&&s._max>=0&&(s.isHorizontal()?e=s.getCoord(0):i=s.getCoord(0));if("undefined"!=typeof e||"undefined"!=typeof i)for(a=n.length;a--;)n[a].refixAxisShape(e,i)},refresh:function(t){if(t||this._zrWidth!=this.zr.getWidth()||this._zrHeight!=this.zr.getHeight()){this.clear(),this.option=t||this.option,this.option.grid=this.reformOption(this.option.grid);var e=this.option.grid;this._zrWidth=this.zr.getWidth(),this._zrHeight=this.zr.getHeight(),this._x=this.parsePercent(e.x,this._zrWidth),this._y=this.parsePercent(e.y,this._zrHeight);var i=this.parsePercent(e.x2,this._zrWidth),o=this.parsePercent(e.y2,this._zrHeight);this._width="undefined"==typeof e.width?this._zrWidth-this._x-i:this.parsePercent(e.width,this._zrWidth),this._width=this._width<=0?10:this._width,this._height="undefined"==typeof e.height?this._zrHeight-this._y-o:this.parsePercent(e.height,this._zrHeight),this._height=this._height<=0?10:this._height,this._x=this.subPixelOptimize(this._x,e.borderWidth),this._y=this.subPixelOptimize(this._y,e.borderWidth),this.shapeList.push(new s({zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:this._x,y:this._y,width:this._width,height:this._height,brushType:e.borderWidth>0?"both":"fill",color:e.backgroundColor,strokeColor:e.borderColor,lineWidth:e.borderWidth}})),this.zr.addShape(this.shapeList[0])}}},n.inherits(e,i),t("../component").define("grid",e),e}),define("echarts/component/dataZoom",["require","./base","zrender/shape/Rectangle","zrender/shape/Polygon","../util/shape/Icon","../config","../util/date","zrender/tool/util","../component"],function(t){function e(t,e,s,o,n){i.call(this,t,e,s,o,n);var a=this;a._ondrift=function(t,e){return a.__ondrift(this,t,e)},a._ondragend=function(){return a.__ondragend()},this._fillerSize=30,this._isSilence=!1,this._zoom={},this.option.dataZoom=this.reformOption(this.option.dataZoom),this.zoomOption=this.option.dataZoom,this._handleSize=this.zoomOption.handleSize,this._location=this._getLocation(),this._zoom=this._getZoom(),this._backupData(),this.option.dataZoom.show&&this._buildShape(),this._syncData()}var i=t("./base"),s=t("zrender/shape/Rectangle"),o=t("zrender/shape/Polygon"),n=t("../util/shape/Icon"),a=t("../config");a.dataZoom={zlevel:0,z:4,show:!1,orient:"horizontal",backgroundColor:"rgba(0,0,0,0)",dataBackgroundColor:"#eee",fillerColor:"rgba(144,197,237,0.2)",handleColor:"rgba(70,130,180,0.8)",handleSize:20,showDetail:!0,realtime:!1};var r=t("../util/date"),h=t("zrender/tool/util");return e.prototype={type:a.COMPONENT_TYPE_DATAZOOM,_buildShape:function(){this._buildBackground(),this._buildFiller(),this._buildHandle(),this._buildFrame();for(var t=0,e=this.shapeList.length;e>t;t++)this.zr.addShape(this.shapeList[t]);this._syncFrameShape()},_getLocation:function(){var t,e,i,s,o=this.component.grid;return"horizontal"==this.zoomOption.orient?(i=this.zoomOption.width||o.getWidth(),s=this.zoomOption.height||this._fillerSize,t=null!=this.zoomOption.x?this.zoomOption.x:o.getX(),e=null!=this.zoomOption.y?this.zoomOption.y:this.zr.getHeight()-s-2):(i=this.zoomOption.width||this._fillerSize,s=this.zoomOption.height||o.getHeight(),t=null!=this.zoomOption.x?this.zoomOption.x:2,e=null!=this.zoomOption.y?this.zoomOption.y:o.getY()),{x:t,y:e,width:i,height:s}},_getZoom:function(){var t=this.option.series,e=this.option.xAxis;!e||e instanceof Array||(e=[e],this.option.xAxis=e);var i=this.option.yAxis;!i||i instanceof Array||(i=[i],this.option.yAxis=i);var s,o,n=[],r=this.zoomOption.xAxisIndex;if(e&&null==r){s=[];for(var h=0,l=e.length;l>h;h++)("category"==e[h].type||null==e[h].type)&&s.push(h)}else s=r instanceof Array?r:null!=r?[r]:[];if(r=this.zoomOption.yAxisIndex,i&&null==r){o=[];for(var h=0,l=i.length;l>h;h++)"category"==i[h].type&&o.push(h)}else o=r instanceof Array?r:null!=r?[r]:[];for(var d,h=0,l=t.length;l>h;h++)if(d=t[h],d.type==a.CHART_TYPE_LINE||d.type==a.CHART_TYPE_BAR||d.type==a.CHART_TYPE_SCATTER||d.type==a.CHART_TYPE_K){for(var c=0,p=s.length;p>c;c++)if(s[c]==(d.xAxisIndex||0)){n.push(h);break}for(var c=0,p=o.length;p>c;c++)if(o[c]==(d.yAxisIndex||0)){n.push(h);break}null==this.zoomOption.xAxisIndex&&null==this.zoomOption.yAxisIndex&&d.data&&this.getDataFromOption(d.data[0])instanceof Array&&(d.type==a.CHART_TYPE_SCATTER||d.type==a.CHART_TYPE_LINE||d.type==a.CHART_TYPE_BAR)&&n.push(h)}var u=null!=this._zoom.start?this._zoom.start:null!=this.zoomOption.start?this.zoomOption.start:0,g=null!=this._zoom.end?this._zoom.end:null!=this.zoomOption.end?this.zoomOption.end:100;u>g&&(u+=g,g=u-g,u-=g);var f=Math.round((g-u)/100*("horizontal"==this.zoomOption.orient?this._location.width:this._location.height));return{start:u,end:g,start2:0,end2:100,size:f,xAxisIndex:s,yAxisIndex:o,seriesIndex:n,scatterMap:this._zoom.scatterMap||{}}},_backupData:function(){this._originalData={xAxis:{},yAxis:{},series:{}};for(var t=this.option.xAxis,e=this._zoom.xAxisIndex,i=0,s=e.length;s>i;i++)this._originalData.xAxis[e[i]]=t[e[i]].data;for(var o=this.option.yAxis,n=this._zoom.yAxisIndex,i=0,s=n.length;s>i;i++)this._originalData.yAxis[n[i]]=o[n[i]].data;for(var r,h=this.option.series,l=this._zoom.seriesIndex,i=0,s=l.length;s>i;i++)r=h[l[i]],this._originalData.series[l[i]]=r.data,r.data&&this.getDataFromOption(r.data[0])instanceof Array&&(r.type==a.CHART_TYPE_SCATTER||r.type==a.CHART_TYPE_LINE||r.type==a.CHART_TYPE_BAR)&&(this._backupScale(),this._calculScatterMap(l[i]))},_calculScatterMap:function(e){this._zoom.scatterMap=this._zoom.scatterMap||{},this._zoom.scatterMap[e]=this._zoom.scatterMap[e]||{};var i=t("../component"),s=i.get("axis"),o=h.clone(this.option.xAxis);"category"==o[0].type&&(o[0].type="value"),o[1]&&"category"==o[1].type&&(o[1].type="value");var n=new s(this.ecTheme,null,!1,{xAxis:o,series:this.option.series},this,"xAxis"),a=this.option.series[e].xAxisIndex||0;this._zoom.scatterMap[e].x=n.getAxis(a).getExtremum(),n.dispose(),o=h.clone(this.option.yAxis),"category"==o[0].type&&(o[0].type="value"),o[1]&&"category"==o[1].type&&(o[1].type="value"),n=new s(this.ecTheme,null,!1,{yAxis:o,series:this.option.series},this,"yAxis"),a=this.option.series[e].yAxisIndex||0,this._zoom.scatterMap[e].y=n.getAxis(a).getExtremum(),n.dispose()},_buildBackground:function(){var t=this._location.width,e=this._location.height;this.shapeList.push(new s({zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:this._location.x,y:this._location.y,width:t,height:e,color:this.zoomOption.backgroundColor}}));for(var i=0,n=this._originalData.xAxis,r=this._zoom.xAxisIndex,h=0,l=r.length;l>h;h++)i=Math.max(i,n[r[h]].length);for(var d=this._originalData.yAxis,c=this._zoom.yAxisIndex,h=0,l=c.length;l>h;h++)i=Math.max(i,d[c[h]].length);for(var p,u=this._zoom.seriesIndex[0],g=this._originalData.series[u],f=Number.MIN_VALUE,m=Number.MAX_VALUE,h=0,l=g.length;l>h;h++)p=this.getDataFromOption(g[h],0),this.option.series[u].type==a.CHART_TYPE_K&&(p=p[1]),isNaN(p)&&(p=0),f=Math.max(f,p),m=Math.min(m,p);var y=f-m,_=[],x=t/(i-(i>1?1:0)),v=e/(i-(i>1?1:0)),b=1;"horizontal"==this.zoomOption.orient&&1>x?b=Math.floor(3*i/t):"vertical"==this.zoomOption.orient&&1>v&&(b=Math.floor(3*i/e));for(var h=0,l=i;l>h;h+=b)p=this.getDataFromOption(g[h],0),this.option.series[u].type==a.CHART_TYPE_K&&(p=p[1]),isNaN(p)&&(p=0),_.push("horizontal"==this.zoomOption.orient?[this._location.x+x*h,this._location.y+e-1-Math.round((p-m)/y*(e-10))]:[this._location.x+1+Math.round((p-m)/y*(t-10)),this._location.y+v*(l-h-1)]);"horizontal"==this.zoomOption.orient?(_.push([this._location.x+t,this._location.y+e]),_.push([this._location.x,this._location.y+e])):(_.push([this._location.x,this._location.y]),_.push([this._location.x,this._location.y+e])),this.shapeList.push(new o({zlevel:this.getZlevelBase(),z:this.getZBase(),style:{pointList:_,color:this.zoomOption.dataBackgroundColor},hoverable:!1}))},_buildFiller:function(){this._fillerShae={zlevel:this.getZlevelBase(),z:this.getZBase(),draggable:!0,ondrift:this._ondrift,ondragend:this._ondragend,_type:"filler"},this._fillerShae.style="horizontal"==this.zoomOption.orient?{x:this._location.x+Math.round(this._zoom.start/100*this._location.width)+this._handleSize,y:this._location.y,width:this._zoom.size-2*this._handleSize,height:this._location.height,color:this.zoomOption.fillerColor,text:":::",textPosition:"inside"}:{x:this._location.x,y:this._location.y+Math.round(this._zoom.start/100*this._location.height)+this._handleSize,width:this._location.width,height:this._zoom.size-2*this._handleSize,color:this.zoomOption.fillerColor,text:"::",textPosition:"inside"},this._fillerShae.highlightStyle={brushType:"fill",color:"rgba(0,0,0,0)"},this._fillerShae=new s(this._fillerShae),this.shapeList.push(this._fillerShae)},_buildHandle:function(){var t=this.zoomOption.showDetail?this._getDetail():{start:"",end:""};this._startShape={zlevel:this.getZlevelBase(),z:this.getZBase(),draggable:!0,style:{iconType:"rectangle",x:this._location.x,y:this._location.y,width:this._handleSize,height:this._handleSize,color:this.zoomOption.handleColor,text:"=",textPosition:"inside"},highlightStyle:{text:t.start,brushType:"fill",textPosition:"left"},ondrift:this._ondrift,ondragend:this._ondragend},"horizontal"==this.zoomOption.orient?(this._startShape.style.height=this._location.height,this._endShape=h.clone(this._startShape),this._startShape.style.x=this._fillerShae.style.x-this._handleSize,this._endShape.style.x=this._fillerShae.style.x+this._fillerShae.style.width,this._endShape.highlightStyle.text=t.end,this._endShape.highlightStyle.textPosition="right"):(this._startShape.style.width=this._location.width,this._endShape=h.clone(this._startShape),this._startShape.style.y=this._fillerShae.style.y+this._fillerShae.style.height,this._startShape.highlightStyle.textPosition="bottom",this._endShape.style.y=this._fillerShae.style.y-this._handleSize,this._endShape.highlightStyle.text=t.end,this._endShape.highlightStyle.textPosition="top"),this._startShape=new n(this._startShape),this._endShape=new n(this._endShape),this.shapeList.push(this._startShape),this.shapeList.push(this._endShape)},_buildFrame:function(){var t=this.subPixelOptimize(this._location.x,1),e=this.subPixelOptimize(this._location.y,1);this._startFrameShape={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:t,y:e,width:this._location.width-(t>this._location.x?1:0),height:this._location.height-(e>this._location.y?1:0),lineWidth:1,brushType:"stroke",strokeColor:this.zoomOption.handleColor}},this._endFrameShape=h.clone(this._startFrameShape),this._startFrameShape=new s(this._startFrameShape),this._endFrameShape=new s(this._endFrameShape),this.shapeList.push(this._startFrameShape),this.shapeList.push(this._endFrameShape)},_syncHandleShape:function(){"horizontal"==this.zoomOption.orient?(this._startShape.style.x=this._fillerShae.style.x-this._handleSize,this._endShape.style.x=this._fillerShae.style.x+this._fillerShae.style.width,this._zoom.start=(this._startShape.style.x-this._location.x)/this._location.width*100,this._zoom.end=(this._endShape.style.x+this._handleSize-this._location.x)/this._location.width*100):(this._startShape.style.y=this._fillerShae.style.y+this._fillerShae.style.height,this._endShape.style.y=this._fillerShae.style.y-this._handleSize,this._zoom.start=(this._location.y+this._location.height-this._startShape.style.y)/this._location.height*100,this._zoom.end=(this._location.y+this._location.height-this._endShape.style.y-this._handleSize)/this._location.height*100),this.zr.modShape(this._startShape.id),this.zr.modShape(this._endShape.id),this._syncFrameShape(),this.zr.refreshNextFrame()},_syncFillerShape:function(){var t,e;"horizontal"==this.zoomOption.orient?(t=this._startShape.style.x,e=this._endShape.style.x,this._fillerShae.style.x=Math.min(t,e)+this._handleSize,this._fillerShae.style.width=Math.abs(t-e)-this._handleSize,this._zoom.start=(Math.min(t,e)-this._location.x)/this._location.width*100,this._zoom.end=(Math.max(t,e)+this._handleSize-this._location.x)/this._location.width*100):(t=this._startShape.style.y,e=this._endShape.style.y,this._fillerShae.style.y=Math.min(t,e)+this._handleSize,this._fillerShae.style.height=Math.abs(t-e)-this._handleSize,this._zoom.start=(this._location.y+this._location.height-Math.max(t,e))/this._location.height*100,this._zoom.end=(this._location.y+this._location.height-Math.min(t,e)-this._handleSize)/this._location.height*100),this.zr.modShape(this._fillerShae.id),this._syncFrameShape(),this.zr.refreshNextFrame()},_syncFrameShape:function(){"horizontal"==this.zoomOption.orient?(this._startFrameShape.style.width=this._fillerShae.style.x-this._location.x,this._endFrameShape.style.x=this._fillerShae.style.x+this._fillerShae.style.width,this._endFrameShape.style.width=this._location.x+this._location.width-this._endFrameShape.style.x):(this._startFrameShape.style.y=this._fillerShae.style.y+this._fillerShae.style.height,this._startFrameShape.style.height=this._location.y+this._location.height-this._startFrameShape.style.y,this._endFrameShape.style.height=this._fillerShae.style.y-this._location.y),this.zr.modShape(this._startFrameShape.id),this.zr.modShape(this._endFrameShape.id)},_syncShape:function(){this.zoomOption.show&&("horizontal"==this.zoomOption.orient?(this._startShape.style.x=this._location.x+this._zoom.start/100*this._location.width,this._endShape.style.x=this._location.x+this._zoom.end/100*this._location.width-this._handleSize,this._fillerShae.style.x=this._startShape.style.x+this._handleSize,this._fillerShae.style.width=this._endShape.style.x-this._startShape.style.x-this._handleSize):(this._startShape.style.y=this._location.y+this._location.height-this._zoom.start/100*this._location.height,this._endShape.style.y=this._location.y+this._location.height-this._zoom.end/100*this._location.height-this._handleSize,this._fillerShae.style.y=this._endShape.style.y+this._handleSize,this._fillerShae.style.height=this._startShape.style.y-this._endShape.style.y-this._handleSize),this.zr.modShape(this._startShape.id),this.zr.modShape(this._endShape.id),this.zr.modShape(this._fillerShae.id),this._syncFrameShape(),this.zr.refresh())},_syncData:function(t){var e,i,s,o,n;for(var r in this._originalData){e=this._originalData[r];for(var h in e)n=e[h],null!=n&&(o=n.length,i=Math.floor(this._zoom.start/100*o),s=Math.ceil(this._zoom.end/100*o),this.getDataFromOption(n[0])instanceof Array&&this.option[r][h].type!=a.CHART_TYPE_K?(this._setScale(),this.option[r][h].data=this._synScatterData(h,n)):this.option[r][h].data=n.slice(i,s))}this._isSilence||!this.zoomOption.realtime&&!t||this.messageCenter.dispatch(a.EVENT.DATA_ZOOM,null,{zoom:this._zoom},this.myChart)},_synScatterData:function(t,e){if(0===this._zoom.start&&100==this._zoom.end&&0===this._zoom.start2&&100==this._zoom.end2)return e;var i,s,o,n,a,r=[],h=this._zoom.scatterMap[t];"horizontal"==this.zoomOption.orient?(i=h.x.max-h.x.min,s=this._zoom.start/100*i+h.x.min,o=this._zoom.end/100*i+h.x.min,i=h.y.max-h.y.min,n=this._zoom.start2/100*i+h.y.min,a=this._zoom.end2/100*i+h.y.min):(i=h.x.max-h.x.min,s=this._zoom.start2/100*i+h.x.min,o=this._zoom.end2/100*i+h.x.min,i=h.y.max-h.y.min,n=this._zoom.start/100*i+h.y.min,a=this._zoom.end/100*i+h.y.min);for(var l,d=0,c=e.length;c>d;d++)l=e[d].value||e[d],l[0]>=s&&l[0]<=o&&l[1]>=n&&l[1]<=a&&r.push(e[d]);return r},_setScale:function(){var t=0!==this._zoom.start||100!==this._zoom.end||0!==this._zoom.start2||100!==this._zoom.end2,e={xAxis:this.option.xAxis,yAxis:this.option.yAxis};for(var i in e)for(var s=0,o=e[i].length;o>s;s++)e[i][s].scale=t||e[i][s]._scale},_backupScale:function(){var t={xAxis:this.option.xAxis,yAxis:this.option.yAxis};for(var e in t)for(var i=0,s=t[e].length;s>i;i++)t[e][i]._scale=t[e][i].scale},_getDetail:function(){var t="horizontal"==this.zoomOption.orient?"xAxis":"yAxis",e=this._originalData[t];for(var i in e){var s=e[i];if(null!=s){var o=s.length,n=Math.floor(this._zoom.start/100*o),a=Math.ceil(this._zoom.end/100*o);return a-=a>0?1:0,{start:this.getDataFromOption(s[n]),end:this.getDataFromOption(s[a])}}}var h=this._zoom.seriesIndex[0],l=this.option.series[h][t+"Index"]||0,d=this.option[t][l].type,c=this._zoom.scatterMap[h][t.charAt(0)].min,p=this._zoom.scatterMap[h][t.charAt(0)].max,u=p-c;if("value"==d)return{start:c+u*this._zoom.start/100,end:c+u*this._zoom.end/100};if("time"==d){p=c+u*this._zoom.end/100,c+=u*this._zoom.start/100;var g=r.getAutoFormatter(c,p).formatter;return{start:r.format(g,c),end:r.format(g,p)}}return{start:"",end:""}},__ondrift:function(t,e,i){this.zoomOption.zoomLock&&(t=this._fillerShae);var s="filler"==t._type?this._handleSize:0;if("horizontal"==this.zoomOption.orient?t.style.x+e-s<=this._location.x?t.style.x=this._location.x+s:t.style.x+e+t.style.width+s>=this._location.x+this._location.width?t.style.x=this._location.x+this._location.width-t.style.width-s:t.style.x+=e:t.style.y+i-s<=this._location.y?t.style.y=this._location.y+s:t.style.y+i+t.style.height+s>=this._location.y+this._location.height?t.style.y=this._location.y+this._location.height-t.style.height-s:t.style.y+=i,"filler"==t._type?this._syncHandleShape():this._syncFillerShape(),this.zoomOption.realtime&&this._syncData(),this.zoomOption.showDetail){var o=this._getDetail();this._startShape.style.text=this._startShape.highlightStyle.text=o.start,this._endShape.style.text=this._endShape.highlightStyle.text=o.end,this._startShape.style.textPosition=this._startShape.highlightStyle.textPosition,this._endShape.style.textPosition=this._endShape.highlightStyle.textPosition}return!0},__ondragend:function(){this.zoomOption.showDetail&&(this._startShape.style.text=this._endShape.style.text="=",this._startShape.style.textPosition=this._endShape.style.textPosition="inside",this.zr.modShape(this._startShape.id),this.zr.modShape(this._endShape.id),this.zr.refreshNextFrame()),this.isDragend=!0},ondragend:function(t,e){this.isDragend&&t.target&&(!this.zoomOption.realtime&&this._syncData(),e.dragOut=!0,e.dragIn=!0,this._isSilence||this.zoomOption.realtime||this.messageCenter.dispatch(a.EVENT.DATA_ZOOM,null,{zoom:this._zoom},this.myChart),e.needRefresh=!1,this.isDragend=!1)},ondataZoom:function(t,e){e.needRefresh=!0},absoluteZoom:function(t){this._zoom.start=t.start,this._zoom.end=t.end,this._zoom.start2=t.start2,this._zoom.end2=t.end2,this._syncShape(),this._syncData(!0)},rectZoom:function(t){if(!t)return this._zoom.start=this._zoom.start2=0,this._zoom.end=this._zoom.end2=100,this._syncShape(),this._syncData(!0),this._zoom;var e=this.component.grid.getArea(),i={x:t.x,y:t.y,width:t.width,height:t.height};if(i.width<0&&(i.x+=i.width,i.width=-i.width),i.height<0&&(i.y+=i.height,i.height=-i.height),i.x>e.x+e.width||i.y>e.y+e.height)return!1;i.x<e.x&&(i.x=e.x),i.x+i.width>e.x+e.width&&(i.width=e.x+e.width-i.x),i.y+i.height>e.y+e.height&&(i.height=e.y+e.height-i.y);var s,o=(i.x-e.x)/e.width,n=1-(i.x+i.width-e.x)/e.width,a=1-(i.y+i.height-e.y)/e.height,r=(i.y-e.y)/e.height;return"horizontal"==this.zoomOption.orient?(s=this._zoom.end-this._zoom.start,this._zoom.start+=s*o,this._zoom.end-=s*n,s=this._zoom.end2-this._zoom.start2,this._zoom.start2+=s*a,this._zoom.end2-=s*r):(s=this._zoom.end-this._zoom.start,this._zoom.start+=s*a,this._zoom.end-=s*r,s=this._zoom.end2-this._zoom.start2,this._zoom.start2+=s*o,this._zoom.end2-=s*n),this._syncShape(),this._syncData(!0),this._zoom},syncBackupData:function(t){for(var e,i,s=this._originalData.series,o=t.series,n=0,a=o.length;a>n;n++){i=o[n].data||o[n].eventList,e=s[n]?Math.floor(this._zoom.start/100*s[n].length):0;for(var r=0,h=i.length;h>r;r++)s[n]&&(s[n][r+e]=i[r])}},syncOption:function(t){this.silence(!0),this.option=t,this.option.dataZoom=this.reformOption(this.option.dataZoom),this.zoomOption=this.option.dataZoom,this.clear(),this._location=this._getLocation(),this._zoom=this._getZoom(),this._backupData(),this.option.dataZoom&&this.option.dataZoom.show&&this._buildShape(),this._syncData(),this.silence(!1)},silence:function(t){this._isSilence=t},getRealDataIndex:function(t,e){if(!this._originalData||0===this._zoom.start&&100==this._zoom.end)return e;var i=this._originalData.series;return i[t]?Math.floor(this._zoom.start/100*i[t].length)+e:-1},resize:function(){this.clear(),this._location=this._getLocation(),this._zoom=this._getZoom(),this.option.dataZoom.show&&this._buildShape()}},h.inherits(e,i),t("../component").define("dataZoom",e),e}),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(t){function e(t,e,s,o,n){if("undefined"==typeof this.query(o,"dataRange.min")||"undefined"==typeof this.query(o,"dataRange.max"))return void console.error("option.dataRange.min or option.dataRange.max has not been defined.");
  2. i.call(this,t,e,s,o,n);var r=this;r._ondrift=function(t,e){return r.__ondrift(this,t,e)},r._ondragend=function(){return r.__ondragend()},r._dataRangeSelected=function(t){return r.__dataRangeSelected(t)},r._dispatchHoverLink=function(t){return r.__dispatchHoverLink(t)},r._onhoverlink=function(t){return r.__onhoverlink(t)},this._selectedMap={},this._range={},this.refresh(o),e.bind(a.EVENT.HOVER,this._onhoverlink)}var i=t("./base"),s=t("zrender/shape/Text"),o=t("zrender/shape/Rectangle"),n=t("../util/shape/HandlePolygon"),a=t("../config");a.dataRange={zlevel:0,z:4,show:!0,orient:"vertical",x:"left",y:"bottom",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:1,itemGap:15,itemWidth:25,itemHeight:25,precision:0,splitNumber:5,calculable:!1,selectedMode:!0,hoverLink:!0,realtime:!0,color:["#006edd","#e0ffff"],textStyle:{fontSize:18,color:"#333"}};var r=t("zrender/tool/util"),h=t("zrender/tool/event"),l=t("zrender/tool/area"),d=t("zrender/tool/color");return e.prototype={type:a.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 t=0,e=this.shapeList.length;e>t;t++)this.zr.addShape(this.shapeList[t]);this._syncShapeFromRange()},_buildItem:function(){var t,e,i,n,a=this._valueTextList,r=a.length,h=this.getFont(this.dataRangeOption.textStyle),d=this._itemGroupLocation.x,c=this._itemGroupLocation.y,p=this.dataRangeOption.itemWidth,u=this.dataRangeOption.itemHeight,g=this.dataRangeOption.itemGap,f=l.getTextHeight("国",h);"vertical"==this.dataRangeOption.orient&&"right"==this.dataRangeOption.x&&(d=this._itemGroupLocation.x+this._itemGroupLocation.width-p);var m=!0;this.dataRangeOption.text&&(m=!1,this.dataRangeOption.text[0]&&(i=this._getTextShape(d,c,this.dataRangeOption.text[0]),"horizontal"==this.dataRangeOption.orient?d+=l.getTextWidth(this.dataRangeOption.text[0],h)+this._textGap:(c+=f+this._textGap,i.style.y+=f/2+this._textGap,i.style.textBaseline="bottom"),this.shapeList.push(new s(i))));for(var y=0;r>y;y++)t=a[y],n=this.getColorByIndex(y),e=this._getItemShape(d,c,p,u,this._selectedMap[y]?n:"#ccc"),e._idx=y,e.onmousemove=this._dispatchHoverLink,this.dataRangeOption.selectedMode&&(e.clickable=!0,e.onclick=this._dataRangeSelected),this.shapeList.push(new o(e)),m&&(i={zlevel:this.getZlevelBase(),z:this.getZBase(),style:{x:d+p+5,y:c,color:this._selectedMap[y]?this.dataRangeOption.textStyle.color:"#ccc",text:a[y],textFont:h,textBaseline:"top"},highlightStyle:{brushType:"fill"}},"vertical"==this.dataRangeOption.orient&&"right"==this.dataRangeOption.x&&(i.style.x-=p+10,i.style.textAlign="right"),i._idx=y,i.onmousemove=this._dispatchHoverLink,this.dataRangeOption.selectedMode&&(i.clickable=!0,i.onclick=this._dataRangeSelected),this.shapeList.push(new s(i))),"horizontal"==this.dataRangeOption.orient?d+=p+(m?5:0)+(m?l.getTextWidth(t,h):0)+g:c+=u+g;!m&&this.dataRangeOption.text[1]&&("horizontal"==this.dataRangeOption.orient?d=d-g+this._textGap:c=c-g+this._textGap,i=this._getTextShape(d,c,this.dataRangeOption.text[1]),"horizontal"!=this.dataRangeOption.orient&&(i.style.y-=5,i.style.textBaseline="top"),this.shapeList.push(new s(i)))},_buildGradient:function(){var e,i,n=this.getFont(this.dataRangeOption.textStyle),a=this._itemGroupLocation.x,r=this._itemGroupLocation.y,h=this.dataRangeOption.itemWidth,d=this.dataRangeOption.itemHeight,c=l.getTextHeight("国",n),p=6,u=!0;this.dataRangeOption.text&&(u=!1,this.dataRangeOption.text[0]&&(i=this._getTextShape(a,r,this.dataRangeOption.text[0]),"horizontal"==this.dataRangeOption.orient?a+=l.getTextWidth(this.dataRangeOption.text[0],n)+this._textGap:(r+=c+this._textGap,i.style.y+=c/2+this._textGap,i.style.textBaseline="bottom"),this.shapeList.push(new s(i))));for(var g=t("zrender/tool/color"),f=1/(this.dataRangeOption.color.length-1),m=[],y=0,_=this.dataRangeOption.color.length;_>y;y++)m.push([y*f,this.dataRangeOption.color[y]]);"horizontal"==this.dataRangeOption.orient?(e={zlevel:this.getZlevelBase(),z:this.getZBase(),style:{x:a,y:r,width:h*p,height:d,color:g.getLinearGradient(a,r,a+h*p,r,m)},hoverable:!1},a+=h*p+this._textGap):(e={zlevel:this.getZlevelBase(),z:this.getZBase(),style:{x:a,y:r,width:h,height:d*p,color:g.getLinearGradient(a,r,a,r+d*p,m)},hoverable:!1},r+=d*p+this._textGap),this.shapeList.push(new o(e)),this._calculableLocation=e.style,this.dataRangeOption.calculable&&(this._buildFiller(),this._bulidMask(),this._bulidHandle()),this._buildIndicator(),!u&&this.dataRangeOption.text[1]&&(i=this._getTextShape(a,r,this.dataRangeOption.text[1]),this.shapeList.push(new s(i)))},_buildIndicator:function(){var t,e,i=this._calculableLocation.x,s=this._calculableLocation.y,o=this._calculableLocation.width,a=this._calculableLocation.height,r=5;"horizontal"==this.dataRangeOption.orient?"bottom"!=this.dataRangeOption.y?(t=[[i,s+a],[i-r,s+a+r],[i+r,s+a+r]],e="bottom"):(t=[[i,s],[i-r,s-r],[i+r,s-r]],e="top"):"right"!=this.dataRangeOption.x?(t=[[i+o,s],[i+o+r,s-r],[i+o+r,s+r]],e="right"):(t=[[i,s],[i-r,s-r],[i-r,s+r]],e="left"),this._indicatorShape={style:{pointList:t,color:"#fff",__rect:{x:Math.min(t[0][0],t[1][0]),y:Math.min(t[0][1],t[1][1]),width:r*("horizontal"==this.dataRangeOption.orient?2:1),height:r*("horizontal"==this.dataRangeOption.orient?1:2)}},highlightStyle:{brushType:"fill",textPosition:e,textColor:this.dataRangeOption.textStyle.color},hoverable:!1},this._indicatorShape=new n(this._indicatorShape)},_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,a,r,h,d=this._calculableLocation.x,c=this._calculableLocation.y,p=this._calculableLocation.width,u=this._calculableLocation.height,g=this.getFont(this.dataRangeOption.textStyle),f=l.getTextHeight("国",g),m=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,c],[d,c+u+f],[d-f,c+u+f],[d-1,c+u],[d-1,c]],e=d-m/2-f,i=c+u+f/2+2,s={x:d-m-f,y:c+u,width:m+f,height:f},o=[[d+p,c],[d+p,c+u+f],[d+p+f,c+u+f],[d+p+1,c+u],[d+p+1,c]],a=d+p+m/2+f,r=i,h={x:d+p,y:c+u,width:m+f,height:f}):(t=[[d,c+u],[d,c-f],[d-f,c-f],[d-1,c],[d-1,c+u]],e=d-m/2-f,i=c-f/2-2,s={x:d-m-f,y:c-f,width:m+f,height:f},o=[[d+p,c+u],[d+p,c-f],[d+p+f,c-f],[d+p+1,c],[d+p+1,c+u]],a=d+p+m/2+f,r=i,h={x:d+p,y:c-f,width:m+f,height:f}):(m+=f,"right"!=this.dataRangeOption.x?(t=[[d,c],[d+p+f,c],[d+p+f,c-f],[d+p,c-1],[d,c-1]],e=d+p+m/2+f/2,i=c-f/2,s={x:d+p,y:c-f,width:m+f,height:f},o=[[d,c+u],[d+p+f,c+u],[d+p+f,c+f+u],[d+p,c+1+u],[d,c+u+1]],a=e,r=c+u+f/2,h={x:d+p,y:c+u,width:m+f,height:f}):(t=[[d+p,c],[d-f,c],[d-f,c-f],[d,c-1],[d+p,c-1]],e=d-m/2-f/2,i=c-f/2,s={x:d-m-f,y:c-f,width:m+f,height:f},o=[[d+p,c+u],[d-f,c+u],[d-f,c+f+u],[d,c+1+u],[d+p,c+u+1]],a=e,r=c+u+f/2,h={x:d-m-f,y:c+u,width:m+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:a,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 n(this._startShape),this._endShape=new n(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.orient?s:0,color:"#ccc"},hoverable:!1},this._startMask=new o(this._startMask),this._endMask=new o(this._endMask),this.shapeList.push(this._startMask),this.shapeList.push(this._endMask)},_buildBackground:function(){var t=this.reformCssArray(this.dataRangeOption.padding);this.shapeList.push(new o({zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:this._itemGroupLocation.x-t[3],y:this._itemGroupLocation.y-t[0],width:this._itemGroupLocation.width+t[3]+t[1],height:this._itemGroupLocation.height+t[0]+t[2],brushType:0===this.dataRangeOption.borderWidth?"fill":"both",color:this.dataRangeOption.backgroundColor,strokeColor:this.dataRangeOption.borderColor,lineWidth:this.dataRangeOption.borderWidth}}))},_getItemGroupLocation:function(){var t=this._valueTextList,e=t.length,i=this.dataRangeOption.itemGap,s=this.dataRangeOption.itemWidth,o=this.dataRangeOption.itemHeight,n=0,a=0,r=this.getFont(this.dataRangeOption.textStyle),h=l.getTextHeight("国",r),d=6;if("horizontal"==this.dataRangeOption.orient){if(this.dataRangeOption.text||this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable)n=(this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable?s*d+i:e*(s+i))+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[0]?l.getTextWidth(this.dataRangeOption.text[0],r)+this._textGap:0)+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[1]?l.getTextWidth(this.dataRangeOption.text[1],r)+this._textGap:0);else{s+=5;for(var c=0;e>c;c++)n+=s+l.getTextWidth(t[c],r)+i}n-=i,a=Math.max(h,o)}else{var p;if(this.dataRangeOption.text||this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable)a=(this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable?o*d+i:e*(o+i))+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[0]?this._textGap+h:0)+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[1]?this._textGap+h:0),p=Math.max(l.getTextWidth(this.dataRangeOption.text&&this.dataRangeOption.text[0]||"",r),l.getTextWidth(this.dataRangeOption.text&&this.dataRangeOption.text[1]||"",r)),n=Math.max(s,p);else{a=(o+i)*e,s+=5,p=0;for(var c=0;e>c;c++)p=Math.max(p,l.getTextWidth(t[c],r));n=s+p}a-=i}var u,g=this.reformCssArray(this.dataRangeOption.padding),f=this.zr.getWidth();switch(this.dataRangeOption.x){case"center":u=Math.floor((f-n)/2);break;case"left":u=g[3]+this.dataRangeOption.borderWidth;break;case"right":u=f-n-g[1]-this.dataRangeOption.borderWidth;break;default:u=this.parsePercent(this.dataRangeOption.x,f),u=isNaN(u)?0:u}var m,y=this.zr.getHeight();switch(this.dataRangeOption.y){case"top":m=g[0]+this.dataRangeOption.borderWidth;break;case"bottom":m=y-a-g[2]-this.dataRangeOption.borderWidth;break;case"center":m=Math.floor((y-a)/2);break;default:m=this.parsePercent(this.dataRangeOption.y,y),m=isNaN(m)?0:m}if(this.dataRangeOption.calculable){var _=Math.max(l.getTextWidth(this.dataRangeOption.max,r),l.getTextWidth(this.dataRangeOption.min,r))+h;"horizontal"==this.dataRangeOption.orient?(_>u&&(u=_),u+n+_>f&&(u-=_)):(h>m&&(m=h),m+a+h>y&&(m-=h))}return{x:u,y:m,width:n,height:a}},_getTextShape:function(t,e,i){return{zlevel:this.getZlevelBase(),z:this.getZBase(),style:{x:"horizontal"==this.dataRangeOption.orient?t:this._itemGroupLocation.x+this._itemGroupLocation.width/2,y:"horizontal"==this.dataRangeOption.orient?this._itemGroupLocation.y+this._itemGroupLocation.height/2:e,color:this.dataRangeOption.textStyle.color,text:i,textFont:this.getFont(this.dataRangeOption.textStyle),textBaseline:"horizontal"==this.dataRangeOption.orient?"middle":"top",textAlign:"horizontal"==this.dataRangeOption.orient?"left":"center"},hoverable:!1}},_getItemShape:function(t,e,i,s,o){return{zlevel:this.getZlevelBase(),z:this.getZBase(),style:{x:t,y:e+1,width:i,height:s-2,color:o},highlightStyle:{strokeColor:o,lineWidth:1}}},__ondrift:function(t,e,i){var s=this._calculableLocation.x,o=this._calculableLocation.y,n=this._calculableLocation.width,a=this._calculableLocation.height;return"horizontal"==this.dataRangeOption.orient?t.style.x+e<=s?t.style.x=s:t.style.x+e+t.style.width>=s+n?t.style.x=s+n-t.style.width:t.style.x+=e:t.style.y+i<=o?t.style.y=o:t.style.y+i+t.style.height>=o+a?t.style.y=o+a-t.style.height:t.style.y+=i,"filler"==t._type?this._syncHandleShape():this._syncFillerShape(t),this.dataRangeOption.realtime&&this._dispatchDataRange(),!0},__ondragend:function(){this.isDragend=!0},ondragend:function(t,e){this.isDragend&&t.target&&(e.dragOut=!0,e.dragIn=!0,this.dataRangeOption.realtime||this._dispatchDataRange(),e.needRefresh=!1,this.isDragend=!1)},_syncShapeFromRange:function(){var t=this.dataRangeOption.range||{};if(this._range.end="undefined"!=typeof this._range.end?this._range.end:"undefined"!=typeof t.start?t.start:0,this._range.start="undefined"!=typeof this._range.start?this._range.start:"undefined"!=typeof t.end?t.end:100,100!=this._range.start||0!==this._range.end){if("horizontal"==this.dataRangeOption.orient){var e=this._fillerShape.style.width;this._fillerShape.style.x+=e*(100-this._range.start)/100,this._fillerShape.style.width=e*(this._range.start-this._range.end)/100}else{var i=this._fillerShape.style.height;this._fillerShape.style.y+=i*(100-this._range.start)/100,this._fillerShape.style.height=i*(this._range.start-this._range.end)/100}this.zr.modShape(this._fillerShape.id),this._syncHandleShape()}},_syncHandleShape:function(){var t=this._calculableLocation.x,e=this._calculableLocation.y,i=this._calculableLocation.width,s=this._calculableLocation.height;"horizontal"==this.dataRangeOption.orient?(this._startShape.style.x=this._fillerShape.style.x,this._startMask.style.width=this._startShape.style.x-t,this._endShape.style.x=this._fillerShape.style.x+this._fillerShape.style.width,this._endMask.style.x=this._endShape.style.x,this._endMask.style.width=t+i-this._endShape.style.x,this._range.start=Math.ceil(100-(this._startShape.style.x-t)/i*100),this._range.end=Math.floor(100-(this._endShape.style.x-t)/i*100)):(this._startShape.style.y=this._fillerShape.style.y,this._startMask.style.height=this._startShape.style.y-e,this._endShape.style.y=this._fillerShape.style.y+this._fillerShape.style.height,this._endMask.style.y=this._endShape.style.y,this._endMask.style.height=e+s-this._endShape.style.y,this._range.start=Math.ceil(100-(this._startShape.style.y-e)/s*100),this._range.end=Math.floor(100-(this._endShape.style.y-e)/s*100)),this._syncShape()},_syncFillerShape:function(t){var e,i,s=this._calculableLocation.x,o=this._calculableLocation.y,n=this._calculableLocation.width,a=this._calculableLocation.height;"horizontal"==this.dataRangeOption.orient?(e=this._startShape.style.x,i=this._endShape.style.x,t.id==this._startShape.id&&e>=i?(i=e,this._endShape.style.x=e):t.id==this._endShape.id&&e>=i&&(e=i,this._startShape.style.x=e),this._fillerShape.style.x=e,this._fillerShape.style.width=i-e,this._startMask.style.width=e-s,this._endMask.style.x=i,this._endMask.style.width=s+n-i,this._range.start=Math.ceil(100-(e-s)/n*100),this._range.end=Math.floor(100-(i-s)/n*100)):(e=this._startShape.style.y,i=this._endShape.style.y,t.id==this._startShape.id&&e>=i?(i=e,this._endShape.style.y=e):t.id==this._endShape.id&&e>=i&&(e=i,this._startShape.style.y=e),this._fillerShape.style.y=e,this._fillerShape.style.height=i-e,this._startMask.style.height=e-o,this._endMask.style.y=i,this._endMask.style.height=o+a-i,this._range.start=Math.ceil(100-(e-o)/a*100),this._range.end=Math.floor(100-(i-o)/a*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.refreshNextFrame()},_dispatchDataRange:function(){this.messageCenter.dispatch(a.EVENT.DATA_RANGE,null,{range:{start:this._range.end,end:this._range.start}},this.myChart)},__dataRangeSelected:function(t){if("single"===this.dataRangeOption.selectedMode)for(var e in this._selectedMap)this._selectedMap[e]=!1;var i=t.target._idx;this._selectedMap[i]=!this._selectedMap[i];var s=(this._colorList.length-i)*this._gap+this.dataRangeOption.min;this.messageCenter.dispatch(a.EVENT.DATA_RANGE_SELECTED,t.event,{selected:this._selectedMap,target:i,valueMax:s,valueMin:s-this._gap},this.myChart),this.messageCenter.dispatch(a.EVENT.REFRESH,null,null,this.myChart)},__dispatchHoverLink:function(t){var e,i;if(this.dataRangeOption.calculable){var s,o=this.dataRangeOption.max-this.dataRangeOption.min;s="horizontal"==this.dataRangeOption.orient?(1-(h.getX(t.event)-this._calculableLocation.x)/this._calculableLocation.width)*o:(1-(h.getY(t.event)-this._calculableLocation.y)/this._calculableLocation.height)*o,e=s-.05*o,i=s+.05*o}else{var n=t.target._idx;i=(this._colorList.length-n)*this._gap+this.dataRangeOption.min,e=i-this._gap}this.messageCenter.dispatch(a.EVENT.DATA_RANGE_HOVERLINK,t.event,{valueMin:e,valueMax:i},this.myChart)},__onhoverlink:function(t){if(this.dataRangeOption.show&&this.dataRangeOption.hoverLink&&this._indicatorShape&&t&&null!=t.seriesIndex&&null!=t.dataIndex){var e=t.value;if(""===e||isNaN(e))return;e<this.dataRangeOption.min?e=this.dataRangeOption.min:e>this.dataRangeOption.max&&(e=this.dataRangeOption.max),this._indicatorShape.position="horizontal"==this.dataRangeOption.orient?[(this.dataRangeOption.max-e)/(this.dataRangeOption.max-this.dataRangeOption.min)*this._calculableLocation.width,0]:[0,(this.dataRangeOption.max-e)/(this.dataRangeOption.max-this.dataRangeOption.min)*this._calculableLocation.height],this._indicatorShape.style.text=this._textFormat(t.value),this._indicatorShape.style.color=this.getColor(e),this.zr.addHoverShape(this._indicatorShape)}},_textFormat:function(t,e){if(t=t.toFixed(this.dataRangeOption.precision),e=null!=e?e.toFixed(this.dataRangeOption.precision):"",this.dataRangeOption.formatter){if("string"==typeof this.dataRangeOption.formatter)return this.dataRangeOption.formatter.replace("{value}",t).replace("{value2}",e);if("function"==typeof this.dataRangeOption.formatter)return this.dataRangeOption.formatter.call(this.myChart,t,e)}return""!==e?t+" - "+e:t},refresh:function(t){if(t){this.option=t,this.option.dataRange=this.reformOption(this.option.dataRange),this.dataRangeOption=this.option.dataRange;var e=this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable?100:this.dataRangeOption.splitNumber;if(this._colorList=d.getGradientColors(this.dataRangeOption.color,Math.max((e-this.dataRangeOption.color.length)/(this.dataRangeOption.color.length-1),0)+1),this._colorList.length>e){for(var i=this._colorList.length,s=[this._colorList[0]],o=i/(e-1),n=1;e-1>n;n++)s.push(this._colorList[Math.floor(n*o)]);s.push(this._colorList[i-1]),this._colorList=s}var a=this.dataRangeOption.precision;for(this._gap=(this.dataRangeOption.max-this.dataRangeOption.min)/e;this._gap.toFixed(a)-0!=this._gap&&5>a;)a++;this.dataRangeOption.precision=a,this._gap=((this.dataRangeOption.max-this.dataRangeOption.min)/e).toFixed(a)-0,this._valueTextList=[];for(var n=0;e>n;n++)this._selectedMap[n]=!0,this._valueTextList.unshift(this._textFormat(n*this._gap+this.dataRangeOption.min,(n+1)*this._gap+this.dataRangeOption.min))}this.clear(),this._buildShape()},getColor:function(t){if(isNaN(t))return null;if(this.dataRangeOption.min==this.dataRangeOption.max)return this._colorList[0];if(t<this.dataRangeOption.min?t=this.dataRangeOption.min:t>this.dataRangeOption.max&&(t=this.dataRangeOption.max),this.dataRangeOption.calculable&&(t-(this._gap*this._range.start+this.dataRangeOption.min)>5e-5||t-(this._gap*this._range.end+this.dataRangeOption.min)<-5e-5))return null;var e=this._colorList.length-Math.ceil((t-this.dataRangeOption.min)/(this.dataRangeOption.max-this.dataRangeOption.min)*this._colorList.length);return e==this._colorList.length&&e--,this._selectedMap[e]?this._colorList[e]:null},getColorByIndex:function(t){return t>=this._colorList.length?t=this._colorList.length-1:0>t&&(t=0),this._colorList[t]},onbeforDispose:function(){this.messageCenter.unbind(a.EVENT.HOVER,this._onhoverlink)}},r.inherits(e,i),t("../component").define("dataRange",e),e}),define("echarts/component/categoryAxis",["require","./base","zrender/shape/Text","zrender/shape/Line","zrender/shape/Rectangle","../config","zrender/tool/util","zrender/tool/area","../component"],function(t){function e(t,e,s,o,n,a){if(o.data.length<1)return void console.error("option.data.length < 1.");i.call(this,t,e,s,o,n),this.grid=this.component.grid;for(var r in a)this[r]=a[r];this.refresh(o)}var i=t("./base"),s=t("zrender/shape/Text"),o=t("zrender/shape/Line"),n=t("zrender/shape/Rectangle"),a=t("../config");a.categoryAxis={zlevel:0,z:0,show:!0,position:"bottom",name:"",nameLocation:"end",nameTextStyle:{},boundaryGap:!0,axisLine:{show:!0,onZero:!0,lineStyle:{color:"#48b",width:2,type:"solid"}},axisTick:{show:!0,interval:"auto",inside:!1,length:5,lineStyle:{color:"#333",width:1}},axisLabel:{show:!0,interval:"auto",rotate:0,margin:8,textStyle:{color:"#333"}},splitLine:{show:!1,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}};var r=t("zrender/tool/util"),h=t("zrender/tool/area");return e.prototype={type:a.COMPONENT_TYPE_AXIS_CATEGORY,_getReformedLabel:function(t){var e=this.getDataFromOption(this.option.data[t]),i=this.option.data[t].formatter||this.option.axisLabel.formatter;return i&&("function"==typeof i?e=i.call(this.myChart,e):"string"==typeof i&&(e=i.replace("{value}",e))),e},_getInterval:function(){var t=this.option.axisLabel.interval;if("auto"==t){var e=this.option.axisLabel.textStyle.fontSize,i=this.option.data,s=this.option.data.length;if(this.isHorizontal())if(s>3){var o,n,a=this.getGap(),l=!1,d=Math.floor(.5/a);for(d=1>d?1:d,t=Math.floor(15/a);!l&&s>t;){t+=d,l=!0,o=Math.floor(a*t);for(var c=Math.floor((s-1)/t)*t;c>=0;c-=t){if(0!==this.option.axisLabel.rotate)n=e;else if(i[c].textStyle)n=h.getTextWidth(this._getReformedLabel(c),this.getFont(r.merge(i[c].textStyle,this.option.axisLabel.textStyle)));else{var p=this._getReformedLabel(c)+"",u=(p.match(/\w/g)||"").length,g=p.length-u;n=u*e*2/3+g*e}if(n>o){l=!1;break}}}}else t=1;else if(s>3){var a=this.getGap();for(t=Math.floor(11/a);e>a*t-6&&s>t;)t++}else t=1}else t="function"==typeof t?1:t-0+1;return t},_buildShape:function(){if(this._interval=this._getInterval(),this.option.show){this.option.splitArea.show&&this._buildSplitArea(),this.option.splitLine.show&&this._buildSplitLine(),this.option.axisLine.show&&this._buildAxisLine(),this.option.axisTick.show&&this._buildAxisTick(),this.option.axisLabel.show&&this._buildAxisLabel();for(var t=0,e=this.shapeList.length;e>t;t++)this.zr.addShape(this.shapeList[t])}},_buildAxisTick:function(){var t,e=this.option.data,i=this.option.data.length,s=this.option.axisTick,n=s.length,a=s.lineStyle.color,r=s.lineStyle.width,h="function"==typeof s.interval?s.interval:"auto"==s.interval&&"function"==typeof this.option.axisLabel.interval?this.option.axisLabel.interval:!1,l=h?1:"auto"==s.interval?this._interval:s.interval-0+1,d=s.onGap,c=d?this.getGap()/2:"undefined"==typeof d&&this.option.boundaryGap?this.getGap()/2:0,p=c>0?-l:0;if(this.isHorizontal())for(var u,g="bottom"==this.option.position?s.inside?this.grid.getYend()-n-1:this.grid.getYend()+1:s.inside?this.grid.getY()+1:this.grid.getY()-n-1,f=p;i>f;f+=l)(!h||h(f,e[f]))&&(u=this.subPixelOptimize(this.getCoordByIndex(f)+(f>=0?c:0),r),t={_axisShape:"axisTick",zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:u,yStart:g,xEnd:u,yEnd:g+n,strokeColor:a,lineWidth:r}},this.shapeList.push(new o(t)));else for(var m,y="left"==this.option.position?s.inside?this.grid.getX()+1:this.grid.getX()-n-1:s.inside?this.grid.getXend()-n-1:this.grid.getXend()+1,f=p;i>f;f+=l)(!h||h(f,e[f]))&&(m=this.subPixelOptimize(this.getCoordByIndex(f)-(f>=0?c:0),r),t={_axisShape:"axisTick",zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:y,yStart:m,xEnd:y+n,yEnd:m,strokeColor:a,lineWidth:r}},this.shapeList.push(new o(t)))},_buildAxisLabel:function(){var t,e,i=this.option.data,o=this.option.data.length,n=this.option.axisLabel,a=n.rotate,h=n.margin,l=n.clickable,d=n.textStyle,c="function"==typeof n.interval?n.interval:!1;if(this.isHorizontal()){var p,u;"bottom"==this.option.position?(p=this.grid.getYend()+h,u="top"):(p=this.grid.getY()-h,u="bottom");for(var g=0;o>g;g+=this._interval)c&&!c(g,i[g])||""===this._getReformedLabel(g)||(e=r.merge(i[g].textStyle||{},d),t={zlevel:this.getZlevelBase(),z:this.getZBase()+3,hoverable:!1,style:{x:this.getCoordByIndex(g),y:p,color:e.color,text:this._getReformedLabel(g),textFont:this.getFont(e),textAlign:e.align||"center",textBaseline:e.baseline||u}},a&&(t.style.textAlign=a>0?"bottom"==this.option.position?"right":"left":"bottom"==this.option.position?"left":"right",t.rotation=[a*Math.PI/180,t.style.x,t.style.y]),this.shapeList.push(new s(this._axisLabelClickable(l,t))))}else{var f,m;"left"==this.option.position?(f=this.grid.getX()-h,m="right"):(f=this.grid.getXend()+h,m="left");for(var g=0;o>g;g+=this._interval)c&&!c(g,i[g])||""===this._getReformedLabel(g)||(e=r.merge(i[g].textStyle||{},d),t={zlevel:this.getZlevelBase(),z:this.getZBase()+3,hoverable:!1,style:{x:f,y:this.getCoordByIndex(g),color:e.color,text:this._getReformedLabel(g),textFont:this.getFont(e),textAlign:e.align||m,textBaseline:e.baseline||0===g&&""!==this.option.name?"bottom":g==o-1&&""!==this.option.name?"top":"middle"}},a&&(t.rotation=[a*Math.PI/180,t.style.x,t.style.y]),this.shapeList.push(new s(this._axisLabelClickable(l,t))))}},_buildSplitLine:function(){var t,e=this.option.data,i=this.option.data.length,s=this.option.splitLine,n=s.lineStyle.type,a=s.lineStyle.width,r=s.lineStyle.color;r=r instanceof Array?r:[r];var h=r.length,l="function"==typeof this.option.axisLabel.interval?this.option.axisLabel.interval:!1,d=s.onGap,c=d?this.getGap()/2:"undefined"==typeof d&&this.option.boundaryGap?this.getGap()/2:0;if(i-=d||"undefined"==typeof d&&this.option.boundaryGap?1:0,this.isHorizontal())for(var p,u=this.grid.getY(),g=this.grid.getYend(),f=0;i>f;f+=this._interval)(!l||l(f,e[f]))&&(p=this.subPixelOptimize(this.getCoordByIndex(f)+c,a),t={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:p,yStart:u,xEnd:p,yEnd:g,strokeColor:r[f/this._interval%h],lineType:n,lineWidth:a}},this.shapeList.push(new o(t)));else for(var m,y=this.grid.getX(),_=this.grid.getXend(),f=0;i>f;f+=this._interval)(!l||l(f,e[f]))&&(m=this.subPixelOptimize(this.getCoordByIndex(f)-c,a),t={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:y,yStart:m,xEnd:_,yEnd:m,strokeColor:r[f/this._interval%h],lineType:n,lineWidth:a}},this.shapeList.push(new o(t)))},_buildSplitArea:function(){var t,e=this.option.data,i=this.option.splitArea,s=i.areaStyle.color;if(s instanceof Array){var o=s.length,a=this.option.data.length,r="function"==typeof this.option.axisLabel.interval?this.option.axisLabel.interval:!1,h=i.onGap,l=h?this.getGap()/2:"undefined"==typeof h&&this.option.boundaryGap?this.getGap()/2:0;if(this.isHorizontal())for(var d,c=this.grid.getY(),p=this.grid.getHeight(),u=this.grid.getX(),g=0;a>=g;g+=this._interval)r&&!r(g,e[g])&&a>g||(d=a>g?this.getCoordByIndex(g)+l:this.grid.getXend(),t={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:u,y:c,width:d-u,height:p,color:s[g/this._interval%o]}},this.shapeList.push(new n(t)),u=d);else for(var f,m=this.grid.getX(),y=this.grid.getWidth(),_=this.grid.getYend(),g=0;a>=g;g+=this._interval)r&&!r(g,e[g])&&a>g||(f=a>g?this.getCoordByIndex(g)-l:this.grid.getY(),t={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:m,y:f,width:y,height:_-f,color:s[g/this._interval%o]}},this.shapeList.push(new n(t)),_=f)}else t={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:this.grid.getX(),y:this.grid.getY(),width:this.grid.getWidth(),height:this.grid.getHeight(),color:s}},this.shapeList.push(new n(t))},refresh:function(t){t&&(this.option=this.reformOption(t),this.option.axisLabel.textStyle=this.getTextStyle(this.option.axisLabel.textStyle)),this.clear(),this._buildShape()},getGap:function(){var t=this.option.data.length,e=this.isHorizontal()?this.grid.getWidth():this.grid.getHeight();return this.option.boundaryGap?e/t:e/(t>1?t-1:1)},getCoord:function(t){for(var e=this.option.data,i=e.length,s=this.getGap(),o=this.option.boundaryGap?s/2:0,n=0;i>n;n++){if(this.getDataFromOption(e[n])==t)return o=this.isHorizontal()?this.grid.getX()+o:this.grid.getYend()-o;o+=s}},getCoordByIndex:function(t){if(0>t)return this.isHorizontal()?this.grid.getX():this.grid.getYend();if(t>this.option.data.length-1)return this.isHorizontal()?this.grid.getXend():this.grid.getY();var e=this.getGap(),i=this.option.boundaryGap?e/2:0;return i+=t*e,i=this.isHorizontal()?this.grid.getX()+i:this.grid.getYend()-i},getNameByIndex:function(t){return this.getDataFromOption(this.option.data[t])},getIndexByName:function(t){for(var e=this.option.data,i=e.length,s=0;i>s;s++)if(this.getDataFromOption(e[s])==t)return s;return-1},getValueFromCoord:function(){return""},isMainAxis:function(t){return t%this._interval===0}},r.inherits(e,i),t("../component").define("categoryAxis",e),e}),define("echarts/component/valueAxis",["require","./base","zrender/shape/Text","zrender/shape/Line","zrender/shape/Rectangle","../config","../util/date","zrender/tool/util","../util/smartSteps","../util/accMath","../component"],function(t){function e(t,e,s,o,n,a,r){if(!r||0===r.length)return void console.err("option.series.length == 0.");i.call(this,t,e,s,o,n),this.series=r,this.grid=this.component.grid;
  3. for(var h in a)this[h]=a[h];this.refresh(o,r)}var i=t("./base"),s=t("zrender/shape/Text"),o=t("zrender/shape/Line"),n=t("zrender/shape/Rectangle"),a=t("../config");a.valueAxis={zlevel:0,z:0,show:!0,position:"left",name:"",nameLocation:"end",nameTextStyle:{},boundaryGap:[0,0],axisLine:{show:!1,onZero:!0,lineStyle:{color:"#48b",width:2,type:"solid"}},axisTick:{show:!1,inside:!1,length:5,lineStyle:{color:"#333",width:1}},axisLabel:{show:!0,rotate:0,margin:-1,textStyle:{align:"left",baseline:"bottom",color:"#333"}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}};var r=t("../util/date"),h=t("zrender/tool/util");return e.prototype={type:a.COMPONENT_TYPE_AXIS_VALUE,_buildShape:function(){if(this._hasData=!1,this._calculateValue(),this._hasData&&this.option.show){this.option.splitArea.show&&this._buildSplitArea(),this.option.splitLine.show&&this._buildSplitLine(),this.option.axisLine.show&&this._buildAxisLine(),this.option.axisTick.show&&this._buildAxisTick(),this.option.axisLabel.show&&this._buildAxisLabel();for(var t=0,e=this.shapeList.length;e>t;t++)this.zr.addShape(this.shapeList[t])}},_buildAxisTick:function(){var t,e=this._valueList,i=this._valueList.length,s=this.option.axisTick,n=s.length,a=s.lineStyle.color,r=s.lineStyle.width;if(this.isHorizontal())for(var h,l="bottom"===this.option.position?s.inside?this.grid.getYend()-n-1:this.grid.getYend()+1:s.inside?this.grid.getY()+1:this.grid.getY()-n-1,d=0;i>d;d++)h=this.subPixelOptimize(this.getCoord(e[d]),r),t={_axisShape:"axisTick",zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:h,yStart:l,xEnd:h,yEnd:l+n,strokeColor:a,lineWidth:r}},this.shapeList.push(new o(t));else for(var c,p="left"===this.option.position?s.inside?this.grid.getX()+1:this.grid.getX()-n-1:s.inside?this.grid.getXend()-n-1:this.grid.getXend()+1,d=0;i>d;d++)c=this.subPixelOptimize(this.getCoord(e[d]),r),t={_axisShape:"axisTick",zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:p,yStart:c,xEnd:p+n,yEnd:c,strokeColor:a,lineWidth:r}},this.shapeList.push(new o(t))},_buildAxisLabel:function(){var t,e=this._valueList,i=this._valueList.length,o=this.option.axisLabel.rotate,n=this.option.axisLabel.margin,a=this.option.axisLabel.clickable,r=this.option.axisLabel.textStyle;if(this.isHorizontal()){var h,l;"bottom"===this.option.position?(h=this.grid.getYend()+n,l="top"):(h=this.grid.getY()-n,l="bottom");for(var d=0;i>d;d++)t={zlevel:this.getZlevelBase(),z:this.getZBase()+3,hoverable:!1,style:{x:this.getCoord(e[d]),y:h,color:"function"==typeof r.color?r.color(e[d]):r.color,text:this._valueLabel[d],textFont:this.getFont(r),textAlign:r.align||"center",textBaseline:r.baseline||l}},o&&(t.style.textAlign=o>0?"bottom"===this.option.position?"right":"left":"bottom"===this.option.position?"left":"right",t.rotation=[o*Math.PI/180,t.style.x,t.style.y]),this.shapeList.push(new s(this._axisLabelClickable(a,t)))}else{var c,p;"left"===this.option.position?(c=this.grid.getX()-n,p="right"):(c=this.grid.getXend()+n,p="left");for(var d=0;i>d;d++)t={zlevel:this.getZlevelBase(),z:this.getZBase()+3,hoverable:!1,style:{x:c,y:this.getCoord(e[d]),color:"function"==typeof r.color?r.color(e[d]):r.color,text:this._valueLabel[d],textFont:this.getFont(r),textAlign:r.align||p,textBaseline:r.baseline||(0===d&&""!==this.option.name?"bottom":d===i-1&&""!==this.option.name?"top":"middle")}},o&&(t.rotation=[o*Math.PI/180,t.style.x,t.style.y]),this.shapeList.push(new s(this._axisLabelClickable(a,t)))}},_buildSplitLine:function(){var t,e=this._valueList,i=this._valueList.length,s=this.option.splitLine,n=s.lineStyle.type,a=s.lineStyle.width,r=s.lineStyle.color;r=r instanceof Array?r:[r];var h=r.length;if(this.isHorizontal())for(var l,d=this.grid.getY(),c=this.grid.getYend(),p=0;i>p;p++)l=this.subPixelOptimize(this.getCoord(e[p]),a),t={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:l,yStart:d,xEnd:l,yEnd:c,strokeColor:r[p%h],lineType:n,lineWidth:a}},this.shapeList.push(new o(t));else for(var u,g=this.grid.getX(),f=this.grid.getXend(),p=0;i>p;p++)u=this.subPixelOptimize(this.getCoord(e[p]),a),t={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:g,yStart:u,xEnd:f,yEnd:u,strokeColor:r[p%h],lineType:n,lineWidth:a}},this.shapeList.push(new o(t))},_buildSplitArea:function(){var t,e=this.option.splitArea.areaStyle.color;if(e instanceof Array){var i=e.length,s=this._valueList,o=this._valueList.length;if(this.isHorizontal())for(var a,r=this.grid.getY(),h=this.grid.getHeight(),l=this.grid.getX(),d=0;o>=d;d++)a=o>d?this.getCoord(s[d]):this.grid.getXend(),t={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:l,y:r,width:a-l,height:h,color:e[d%i]}},this.shapeList.push(new n(t)),l=a;else for(var c,p=this.grid.getX(),u=this.grid.getWidth(),g=this.grid.getYend(),d=0;o>=d;d++)c=o>d?this.getCoord(s[d]):this.grid.getY(),t={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:p,y:c,width:u,height:g-c,color:e[d%i]}},this.shapeList.push(new n(t)),g=c}else t={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:this.grid.getX(),y:this.grid.getY(),width:this.grid.getWidth(),height:this.grid.getHeight(),color:e}},this.shapeList.push(new n(t))},_calculateValue:function(){if(isNaN(this.option.min-0)||isNaN(this.option.max-0)){for(var t,e,i={},s=this.component.legend,o=0,n=this.series.length;n>o;o++)!(this.series[o].type!=a.CHART_TYPE_LINE&&this.series[o].type!=a.CHART_TYPE_BAR&&this.series[o].type!=a.CHART_TYPE_SCATTER&&this.series[o].type!=a.CHART_TYPE_K&&this.series[o].type!=a.CHART_TYPE_EVENTRIVER||s&&!s.isSelected(this.series[o].name)||(t=this.series[o].xAxisIndex||0,e=this.series[o].yAxisIndex||0,this.option.xAxisIndex!=t&&this.option.yAxisIndex!=e||!this._calculSum(i,o)));var r;for(var o in i){r=i[o];for(var h=0,l=r.length;l>h;h++)if(!isNaN(r[h])){this._hasData=!0,this._min=r[h],this._max=r[h];break}if(this._hasData)break}for(var o in i){r=i[o];for(var h=0,l=r.length;l>h;h++)isNaN(r[h])||(this._min=Math.min(this._min,r[h]),this._max=Math.max(this._max,r[h]))}var d=Math.abs(this._max-this._min);this._min=isNaN(this.option.min-0)?this._min-Math.abs(d*this.option.boundaryGap[0]):this.option.min-0,this._max=isNaN(this.option.max-0)?this._max+Math.abs(d*this.option.boundaryGap[1]):this.option.max-0,this._min===this._max&&(0===this._max?this._max=1:this._max>0?this._min=this._max/this.option.splitNumber!=null?this.option.splitNumber:5:this._max=this._max/this.option.splitNumber!=null?this.option.splitNumber:5),"time"!=this.option.type?this._reformValue(this.option.scale):this._reformTimeValue()}else this._hasData=!0,this._min=this.option.min-0,this._max=this.option.max-0,"time"!=this.option.type?this._customerValue():this._reformTimeValue()},_calculSum:function(t,e){var i,s,o=this.series[e].name||"kener";if(this.series[e].stack){var n="__Magic_Key_Positive__"+this.series[e].stack,h="__Magic_Key_Negative__"+this.series[e].stack;t[n]=t[n]||[],t[h]=t[h]||[],t[o]=t[o]||[],s=this.series[e].data;for(var l=0,d=s.length;d>l;l++)i=this.getDataFromOption(s[l]),"-"!==i&&(i-=0,i>=0?null!=t[n][l]?t[n][l]+=i:t[n][l]=i:null!=t[h][l]?t[h][l]+=i:t[h][l]=i,this.option.scale&&t[o].push(i))}else if(t[o]=t[o]||[],this.series[e].type!=a.CHART_TYPE_EVENTRIVER){s=this.series[e].data;for(var l=0,d=s.length;d>l;l++)i=this.getDataFromOption(s[l]),this.series[e].type===a.CHART_TYPE_K?(t[o].push(i[0]),t[o].push(i[1]),t[o].push(i[2]),t[o].push(i[3])):i instanceof Array?(-1!=this.option.xAxisIndex&&t[o].push("time"!=this.option.type?i[0]:r.getNewDate(i[0])),-1!=this.option.yAxisIndex&&t[o].push("time"!=this.option.type?i[1]:r.getNewDate(i[1]))):t[o].push(i)}else{s=this.series[e].eventList;for(var l=0,d=s.length;d>l;l++)for(var c=s[l].evolution,p=0,u=c.length;u>p;p++)t[o].push(r.getNewDate(c[p].time))}},_reformValue:function(e){var i=t("../util/smartSteps"),s=this.option.splitNumber;!e&&this._min>=0&&this._max>=0&&(this._min=0),!e&&this._min<=0&&this._max<=0&&(this._max=0);var o=i(this._min,this._max,s);s=null!=s?s:o.secs,this._min=o.min,this._max=o.max,this._valueList=o.pnts,this._reformLabelData()},_reformTimeValue:function(){var t=null!=this.option.splitNumber?this.option.splitNumber:5,e=r.getAutoFormatter(this._min,this._max,t),i=e.formatter,s=e.gapValue;this._valueList=[r.getNewDate(this._min)];var o;switch(i){case"week":o=r.nextMonday(this._min);break;case"month":o=r.nextNthOnMonth(this._min,1);break;case"quarter":o=r.nextNthOnQuarterYear(this._min,1);break;case"half-year":o=r.nextNthOnHalfYear(this._min,1);break;case"year":o=r.nextNthOnYear(this._min,1);break;default:72e5>=s?o=(Math.floor(this._min/s)+1)*s:(o=r.getNewDate(this._min- -s),o.setHours(6*Math.round(o.getHours()/6)),o.setMinutes(0),o.setSeconds(0))}for(o-this._min<s/2&&(o-=-s),e=r.getNewDate(o),t*=1.5;t-->=0&&(("month"==i||"quarter"==i||"half-year"==i||"year"==i)&&e.setDate(1),!(this._max-e<s/2));)this._valueList.push(e),e=r.getNewDate(e- -s);this._valueList.push(r.getNewDate(this._max)),this._reformLabelData(i)},_customerValue:function(){var e=t("../util/accMath"),i=null!=this.option.splitNumber?this.option.splitNumber:5,s=(this._max-this._min)/i;this._valueList=[];for(var o=0;i>=o;o++)this._valueList.push(e.accAdd(this._min,e.accMul(s,o)));this._reformLabelData()},_reformLabelData:function(t){this._valueLabel=[];var e=this.option.axisLabel.formatter;if(e)for(var i=0,s=this._valueList.length;s>i;i++)"function"==typeof e?this._valueLabel.push(t?e.call(this.myChart,this._valueList[i],t):e.call(this.myChart,this._valueList[i])):"string"==typeof e&&this._valueLabel.push(t?r.format(e,this._valueList[i]):e.replace("{value}",this._valueList[i]));else if(t)for(var i=0,s=this._valueList.length;s>i;i++)this._valueLabel.push(r.format(t,this._valueList[i]));else for(var i=0,s=this._valueList.length;s>i;i++)this._valueLabel.push(this.numAddCommas(this._valueList[i]))},getExtremum:function(){return this._calculateValue(),{min:this._min,max:this._max}},refresh:function(t,e){t&&(this.option=this.reformOption(t),this.option.axisLabel.textStyle=h.merge(this.option.axisLabel.textStyle||{},this.ecTheme.textStyle),this.series=e),this.zr&&(this.clear(),this._buildShape())},getCoord:function(t){t=t<this._min?this._min:t,t=t>this._max?this._max:t;var e;return e=this.isHorizontal()?this.grid.getX()+(t-this._min)/(this._max-this._min)*this.grid.getWidth():this.grid.getYend()-(t-this._min)/(this._max-this._min)*this.grid.getHeight()},getCoordSize:function(t){return Math.abs(this.isHorizontal()?t/(this._max-this._min)*this.grid.getWidth():t/(this._max-this._min)*this.grid.getHeight())},getValueFromCoord:function(t){var e;return this.isHorizontal()?(t=t<this.grid.getX()?this.grid.getX():t,t=t>this.grid.getXend()?this.grid.getXend():t,e=this._min+(t-this.grid.getX())/this.grid.getWidth()*(this._max-this._min)):(t=t<this.grid.getY()?this.grid.getY():t,t=t>this.grid.getYend()?this.grid.getYend():t,e=this._max-(t-this.grid.getY())/this.grid.getHeight()*(this._max-this._min)),e.toFixed(2)-0},isMaindAxis:function(t){for(var e=0,i=this._valueList.length;i>e;e++)if(this._valueList[e]===t)return!0;return!1}},h.inherits(e,i),t("../component").define("valueAxis",e),e}),define("echarts/util/date",[],function(){function t(t,e,i){i=i>1?i:2;for(var s,o,n,a,r=0,h=d.length;h>r;r++)if(s=d[r].value,o=Math.ceil(e/s)*s-Math.floor(t/s)*s,Math.round(o/s)<=1.2*i){n=d[r].formatter,a=d[r].value;break}return null==n&&(n="year",s=317088e5,o=Math.ceil(e/s)*s-Math.floor(t/s)*s,a=Math.round(o/(i-1)/s)*s),{formatter:n,gapValue:a}}function e(t){return 10>t?"0"+t:t}function i(t,i){("week"==t||"month"==t||"quarter"==t||"half-year"==t||"year"==t)&&(t="MM - dd\nyyyy");var s=l(i),o=s.getFullYear(),n=s.getMonth()+1,a=s.getDate(),r=s.getHours(),h=s.getMinutes(),d=s.getSeconds();return t=t.replace("MM",e(n)),t=t.toLowerCase(),t=t.replace("yyyy",o),t=t.replace("yy",o%100),t=t.replace("dd",e(a)),t=t.replace("d",a),t=t.replace("hh",e(r)),t=t.replace("h",r),t=t.replace("mm",e(h)),t=t.replace("m",h),t=t.replace("ss",e(d)),t=t.replace("s",d)}function s(t){return t=l(t),t.setDate(t.getDate()+8-t.getDay()),t}function o(t,e,i){return t=l(t),t.setMonth(Math.ceil((t.getMonth()+1)/i)*i),t.setDate(e),t}function n(t,e){return o(t,e,1)}function a(t,e){return o(t,e,3)}function r(t,e){return o(t,e,6)}function h(t,e){return o(t,e,12)}function l(t){return t instanceof Date?t:new Date("string"==typeof t?t.replace(/-/g,"/"):t)}var d=[{formatter:"hh : mm : ss",value:1e3},{formatter:"hh : mm : ss",value:5e3},{formatter:"hh : mm : ss",value:1e4},{formatter:"hh : mm : ss",value:15e3},{formatter:"hh : mm : ss",value:3e4},{formatter:"hh : mm\nMM - dd",value:6e4},{formatter:"hh : mm\nMM - dd",value:3e5},{formatter:"hh : mm\nMM - dd",value:6e5},{formatter:"hh : mm\nMM - dd",value:9e5},{formatter:"hh : mm\nMM - dd",value:18e5},{formatter:"hh : mm\nMM - dd",value:36e5},{formatter:"hh : mm\nMM - dd",value:72e5},{formatter:"hh : mm\nMM - dd",value:216e5},{formatter:"hh : mm\nMM - dd",value:432e5},{formatter:"MM - dd\nyyyy",value:864e5},{formatter:"week",value:6048e5},{formatter:"month",value:26784e5},{formatter:"quarter",value:8208e6},{formatter:"half-year",value:16416e6},{formatter:"year",value:32832e6}];return{getAutoFormatter:t,getNewDate:l,format:i,nextMonday:s,nextNthPerNmonth:o,nextNthOnMonth:n,nextNthOnQuarterYear:a,nextNthOnHalfYear:r,nextNthOnYear:h}}),define("echarts/util/smartSteps",[],function(){function t(t){return C.log(E(t))/C.LN10}function e(t){return C.pow(10,t)}function i(t){return t===M(t)}function s(t,e,s,o){x=o||{},v=x.steps||T,b=x.secs||L,s=w(+s||0)%99,t=+t||0,e=+e||0,S=z=0,"min"in x&&(t=+x.min||0,S=1),"max"in x&&(e=+x.max||0,z=1),t>e&&(e=[t,t=e][0]);var n=e-t;if(S&&z)return _(t,e,s);if((s||5)>n){if(i(t)&&i(e))return u(t,e,s);if(0===n)return g(t,e,s)}return l(t,e,s)}function o(t,i,s,o){o=o||0;var r=n((i-t)/s,-1),h=n(t,-1,1),l=n(i,-1),d=C.min(r.e,h.e,l.e);0===h.c?d=C.min(r.e,l.e):0===l.c&&(d=C.min(r.e,h.e)),a(r,{c:0,e:d}),a(h,r,1),a(l,r),o+=d,t=h.c,i=l.c;for(var c=(i-t)/s,p=e(o),u=0,g=[],f=s+1;f--;)g[f]=(t+c*f)*p;if(0>o){u=m(p),c=+(c*p).toFixed(u),t=+(t*p).toFixed(u),i=+(i*p).toFixed(u);for(var f=g.length;f--;)g[f]=g[f].toFixed(u),0===+g[f]&&(g[f]="0")}else t*=p,i*=p,c*=p;return b=0,v=0,x=0,{min:t,max:i,secs:s,step:c,fix:u,exp:o,pnts:g}}function n(s,o,n){o=w(o%10)||2,0>o&&(i(s)?o=(""+E(s)).replace(/0+$/,"").length||1:(s=s.toFixed(15).replace(/0+$/,""),o=s.replace(".","").replace(/^[-0]+/,"").length,s=+s));var a=M(t(s))-o+1,r=+(s*e(-a)).toFixed(15)||0;return r=n?M(r):A(r),!r&&(a=0),(""+E(r)).length>o&&(a+=1,r/=10),{c:r,e:a}}function a(t,i,s){var o=i.e-t.e;o&&(t.e+=o,t.c*=e(-o),t.c=s?M(t.c):A(t.c))}function r(t,e,i){t.e<e.e?a(e,t,i):a(t,e,i)}function h(t,e){e=e||T,t=n(t);for(var i=t.c,s=0;i>e[s];)s++;if(!e[s])for(i/=10,t.e+=1,s=0;i>e[s];)s++;return t.c=e[s],t}function l(t,e,s){var r,l=s||+b.slice(-1),g=h((e-t)/l,v),m=n(e-t),_=n(t,-1,1),x=n(e,-1);if(a(m,g),a(_,g,1),a(x,g),s?r=c(_,x,l):l=d(_,x),i(t)&&i(e)&&t*e>=0){if(l>e-t)return u(t,e,l);l=p(t,e,s,_,x,l)}var T=f(t,e,_.c,x.c);return _.c=T[0],x.c=T[1],(S||z)&&y(t,e,_,x),o(_.c,x.c,l,x.e)}function d(t,i){for(var s,o,n,a,r=[],l=b.length;l--;)s=b[l],o=h((i.c-t.c)/s,v),o=o.c*e(o.e),n=M(t.c/o)*o,a=A(i.c/o)*o,r[l]={min:n,max:a,step:o,span:a-n};return r.sort(function(t,e){var i=t.span-e.span;return 0===i&&(i=t.step-e.step),i}),r=r[0],s=r.span/r.step,t.c=r.min,i.c=r.max,3>s?2*s:s}function c(t,i,s){for(var o,n,a=i.c,r=(i.c-t.c)/s-1;a>t.c;)r=h(r+1,v),r=r.c*e(r.e),o=r*s,n=A(i.c/r)*r,a=n-o;var l=t.c-a,d=n-i.c,c=l-d;return c>1.1*r&&(c=w(c/r/2)*r,a+=c,n+=c),t.c=a,i.c=n,r}function p(t,s,o,n,a,r){var h=a.c-n.c,l=h/r*e(a.e);if(!i(l)&&(l=M(l),h=l*r,s-t>h&&(l+=1,h=l*r,!o&&l*(r-1)>=s-t&&(r-=1,h=l*r)),h>=s-t)){var d=h-(s-t);n.c=w(t-d/2),a.c=w(s+d/2),n.e=0,a.e=0}return r}function u(t,e,i){if(i=i||5,S)e=t+i;else if(z)t=e-i;else{var s=i-(e-t),n=w(t-s/2),a=w(e+s/2),r=f(t,e,n,a);t=r[0],e=r[1]}return o(t,e,i)}function g(t,e,i){i=i||5;var s=C.min(E(e/i),i)/2.1;return S?e=t+s:z?t=e-s:(t-=s,e+=s),l(t,e,i)}function f(t,e,i,s){return t>=0&&0>i?(s-=i,i=0):0>=e&&s>0&&(i-=s,s=0),[i,s]}function m(t){return t=(+t).toFixed(15).split("."),t.pop().replace(/0+$/,"").length}function y(t,e,i,s){if(S){var o=n(t,4,1);i.e-o.e>6&&(o={c:0,e:i.e}),r(i,o),r(s,o),s.c+=o.c-i.c,i.c=o.c}else if(z){var a=n(e,4);s.e-a.e>6&&(a={c:0,e:s.e}),r(i,a),r(s,a),i.c+=a.c-s.c,s.c=a.c}}function _(t,e,i){var s=i?[i]:b,r=e-t;if(0===r)return e=n(e,3),i=s[0],e.c=w(e.c+i/2),o(e.c-i,e.c,i,e.e);E(e/r)<1e-6&&(e=0),E(t/r)<1e-6&&(t=0);var h,l,d,c=[[5,10],[10,2],[50,10],[100,2]],p=[],u=[],g=n(e-t,3),f=n(t,-1,1),m=n(e,-1);a(f,g,1),a(m,g),r=m.c-f.c,g.c=r;for(var y=s.length;y--;){i=s[y],h=A(r/i),l=h*i-r,d=3*(l+3),d+=2*(i-s[0]+2),i%5===0&&(d-=10);for(var _=c.length;_--;)h%c[_][0]===0&&(d/=c[_][1]);u[y]=[i,h,l,d].join(),p[y]={secs:i,step:h,delta:l,score:d}}return p.sort(function(t,e){return t.score-e.score}),p=p[0],f.c=w(f.c-p.delta/2),m.c=w(m.c+p.delta/2),o(f.c,m.c,p.secs,g.e)}var x,v,b,S,z,T=[10,20,25,50],L=[4,5,6],C=Math,w=C.round,M=C.floor,A=C.ceil,E=C.abs;return s}),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});