You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
13 KiB
JavaScript

5 years ago
define("echarts/chart/line",["require","./base","zrender/shape/Polyline","../util/shape/Icon","../util/shape/HalfSmoothPolygon","../component/axis","../component/grid","../component/dataZoom","../config","../util/ecData","zrender/tool/util","zrender/tool/color","../chart"],function(e){function t(e,t,i,a,o){n.call(this,e,t,i,a,o),this.refresh(a)}function i(e,t,i){var n=t.x,a=t.y,r=t.width,s=t.height,l=s/2;t.symbol.match("empty")&&(e.fillStyle="#fff"),t.brushType="both";var h=t.symbol.replace("empty","").toLowerCase();h.match("star")?(l=h.replace("star","")-0||5,a-=1,h="star"):("rectangle"===h||"arrow"===h)&&(n+=(r-s)/2,r=s);var d="";if(h.match("image")&&(d=h.replace(new RegExp("^image:\\/\\/"),""),h="image",n+=Math.round((r-s)/2)-1,r=s+=2),h=o.prototype.iconLibrary[h]){var c=t.x,m=t.y;e.moveTo(c,m+l),e.lineTo(c+5,m+l),e.moveTo(c+t.width-5,m+l),e.lineTo(c+t.width,m+l);var p=this;h(e,{x:n+4,y:a+4,width:r-8,height:s-8,n:l,image:d},function(){p.modSelf(),i()})}else e.moveTo(n,a+l),e.lineTo(n+r,a+l)}var n=e("./base"),a=e("zrender/shape/Polyline"),o=e("../util/shape/Icon"),r=e("../util/shape/HalfSmoothPolygon");e("../component/axis"),e("../component/grid"),e("../component/dataZoom");var s=e("../config");s.line={zlevel:0,z:2,clickable:!0,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,dataFilter:"nearest",itemStyle:{normal:{label:{show:!1},lineStyle:{width:2,type:"solid",shadowColor:"rgba(0,0,0,0)",shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0}},emphasis:{label:{show:!1}}},symbolSize:2,showAllSymbol:!1};var l=e("../util/ecData"),h=e("zrender/tool/util"),d=e("zrender/tool/color");return t.prototype={type:s.CHART_TYPE_LINE,_buildShape:function(){this.finalPLMap={},this._buildPosition()},_buildHorizontal:function(e,t,i,n){for(var a,o,r,s,l,h,d,c,m,p=this.series,u=i[0][0],V=p[u],U=this.component.xAxis.getAxis(V.xAxisIndex||0),g={},f=0,y=t;y>f&&null!=U.getNameByIndex(f);f++){o=U.getCoordByIndex(f);for(var b=0,_=i.length;_>b;b++){a=this.component.yAxis.getAxis(p[i[b][0]].yAxisIndex||0),l=s=d=h=a.getCoord(0);for(var x=0,k=i[b].length;k>x;x++)u=i[b][x],V=p[u],c=V.data[f],m=this.getDataFromOption(c,"-"),g[u]=g[u]||[],n[u]=n[u]||{min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY,sum:0,counter:0,average:0},"-"!==m?(m>=0?(s-=x>0?a.getCoordSize(m):l-a.getCoord(m),r=s):0>m&&(h+=x>0?a.getCoordSize(m):a.getCoord(m)-d,r=h),g[u].push([o,r,f,U.getNameByIndex(f),o,l]),n[u].min>m&&(n[u].min=m,n[u].minY=r,n[u].minX=o),n[u].max<m&&(n[u].max=m,n[u].maxY=r,n[u].maxX=o),n[u].sum+=m,n[u].counter++):g[u].length>0&&(this.finalPLMap[u]=this.finalPLMap[u]||[],this.finalPLMap[u].push(g[u]),g[u]=[])}s=this.component.grid.getY();for(var v,b=0,_=i.length;_>b;b++)for(var x=0,k=i[b].length;k>x;x++)u=i[b][x],V=p[u],c=V.data[f],m=this.getDataFromOption(c,"-"),"-"==m&&this.deepQuery([c,V,this.option],"calculable")&&(v=this.deepQuery([c,V],"symbolSize"),s+=2*v+5,r=s,this.shapeList.push(this._getCalculableItem(u,f,U.getNameByIndex(f),o,r,"horizontal")))}for(var L in g)g[L].length>0&&(this.finalPLMap[L]=this.finalPLMap[L]||[],this.finalPLMap[L].push(g[L]),g[L]=[]);this._calculMarkMapXY(n,i,"y"),this._buildBorkenLine(e,this.finalPLMap,U,"horizontal")},_buildVertical:function(e,t,i,n){for(var a,o,r,s,l,h,d,c,m,p=this.series,u=i[0][0],V=p[u],U=this.component.yAxis.getAxis(V.yAxisIndex||0),g={},f=0,y=t;y>f&&null!=U.getNameByIndex(f);f++){r=U.getCoordByIndex(f);for(var b=0,_=i.length;_>b;b++){a=this.component.xAxis.getAxis(p[i[b][0]].xAxisIndex||0),l=s=d=h=a.getCoord(0);for(var x=0,k=i[b].length;k>x;x++)u=i[b][x],V=p[u],c=V.data[f],m=this.getDataFromOption(c,"-"),g[u]=g[u]||[],n[u]=n[u]||{min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY,sum:0,counter:0,average:0},"-"!==m?(m>=0?(s+=x>0?a.getCoordSize(m):a.getCoord(m)-l,o=s):0>m&&(h-=x>0?a.getCoordSize(m):d-a.getCoord(m),o=h),g[u].push([o,r,f,U.getNameByIndex(f),l,r]),n[u].min>m&&(n[u].min=m,n[u].minX=o,n[u].minY=r),n[u].max<m&&(n[u].max=m,n[u].maxX=o,n[u].maxY=r),n[u].sum+=m,n[u].counter++):g[u].length>0&&(this.finalPLMap[u]=this.finalPLMap[u]||[],this.finalPLMap[u].push(g[u]),g[u]=[])}s=this.component.grid.getXe