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

1 line
18 KiB
JavaScript
Raw Normal View History

2024-03-18 10:04:33 +08:00
define("echarts/chart/radar",["require","./base","zrender/shape/Polygon","../component/polar","../config","../util/ecData","zrender/tool/util","zrender/tool/color","../util/accMath","../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("zrender/shape/Polygon");t("../component/polar");var o=t("../config");o.radar={zlevel:0,z:2,clickable:!0,legendHoverLink:!0,polarIndex:0,itemStyle:{normal:{label:{show:!1},lineStyle:{width:2,type:"solid"}},emphasis:{label:{show:!1}}},symbolSize:2};var n=t("../util/ecData"),a=t("zrender/tool/util"),r=t("zrender/tool/color");return e.prototype={type:o.CHART_TYPE_RADAR,_buildShape:function(){this.selectedMap={},this._symbol=this.option.symbolList,this._queryTarget,this._dropBoxList=[],this._radarDataCounter=0;for(var t,e=this.series,i=this.component.legend,s=0,n=e.length;n>s;s++)e[s].type===o.CHART_TYPE_RADAR&&(this.serie=this.reformOption(e[s]),this.legendHoverLink=e[s].legendHoverLink||this.legendHoverLink,t=this.serie.name||"",this.selectedMap[t]=i?i.isSelected(t):!0,this.selectedMap[t]&&(this._queryTarget=[this.serie,this.option],this.deepQuery(this._queryTarget,"calculable")&&this._addDropBox(s),this._buildSingleRadar(s),this.buildMark(s)));this.addShapeList()},_buildSingleRadar:function(t){for(var e,i,s,o,n=this.component.legend,a=this.serie.data,r=this.deepQuery(this._queryTarget,"calculable"),h=0;h<a.length;h++)s=a[h].name||"",this.selectedMap[s]=n?n.isSelected(s):!0,this.selectedMap[s]&&(n?(i=n.getColor(s),e=n.getItemShape(s),e&&(e.style.brushType=this.deepQuery([a[h],this.serie],"itemStyle.normal.areaStyle")?"both":"stroke",n.setItemShape(s,e))):i=this.zr.getColor(h),o=this._getPointList(this.serie.polarIndex,a[h]),this._addSymbol(o,i,h,t,this.serie.polarIndex),this._addDataShape(o,i,a[h],t,h,r),this._radarDataCounter++)},_getPointList:function(t,e){for(var i,s,o=[],n=this.component.polar,a=0,r=e.value.length;r>a;a++)s=this.getDataFromOption(e.value[a]),i="-"!=s?n.getVector(t,a,s):!1,i&&o.push(i);return o},_addSymbol:function(t,e,i,s,o){for(var a,r=this.series,h=this.component.polar,l=0,d=t.length;d>l;l++)a=this.getSymbolShape(this.deepMerge([r[s].data[i],r[s]]),s,r[s].data[i].value[l],l,h.getIndicatorText(o,l),t[l][0],t[l][1],this._symbol[this._radarDataCounter%this._symbol.length],e,"#fff","vertical"),a.zlevel=this.getZlevelBase(),a.z=this.getZBase()+1,n.set(a,"data",r[s].data[i]),n.set(a,"value",r[s].data[i].value),n.set(a,"dataIndex",i),n.set(a,"special",l),this.shapeList.push(a)},_addDataShape:function(t,e,i,o,a,h){var l=this.series,d=[i,this.serie],c=this.getItemStyleColor(this.deepQuery(d,"itemStyle.normal.color"),o,a,i),p=this.deepQuery(d,"itemStyle.normal.lineStyle.width"),u=this.deepQuery(d,"itemStyle.normal.lineStyle.type"),g=this.deepQuery(d,"itemStyle.normal.areaStyle.color"),f=this.deepQuery(d,"itemStyle.normal.areaStyle"),m={zlevel:this.getZlevelBase(),z:this.getZBase(),style:{pointList:t,brushType:f?"both":"stroke",color:g||c||("string"==typeof e?r.alpha(e,.5):e),strokeColor:c||e,lineWidth:p,lineType:u},highlightStyle:{brushType:this.deepQuery(d,"itemStyle.emphasis.areaStyle")||f?"both":"stroke",color:this.deepQuery(d,"itemStyle.emphasis.areaStyle.color")||g||c||("string"==typeof e?r.alpha(e,.5):e),strokeColor:this.getItemStyleColor(this.deepQuery(d,"itemStyle.emphasis.color"),o,a,i)||c||e,lineWidth:this.deepQuery(d,"itemStyle.emphasis.lineStyle.width")||p,lineType:this.deepQuery(d,"itemStyle.emphasis.lineStyle.type")||u}};n.pack(m,l[o],o,i,a,i.name,this.component.polar.getIndicator(l[o].polarIndex)),h&&(m.draggable=!0,this.setCalculable(m)),m=new s(m),this.shapeList.push(m)},_addDropBox:function(t){var e=this.series,i=this.deepQuery(this._queryTarget,"polarIndex");if(!this._dropBoxList[i]){var s=this.component.polar.getDropBox(i);s.zlevel=this.getZlevelBase(),s.z=this.getZBase(),this.setCalculable(s),n.pack(s,e,t,void 0,-1),this.shapeList.push(s),this._dropBoxList[i]=!0}},ondragend:function(t,e){var i=this.series;if(this.isDragend&&t.target){var s=t.target,o=n.get(s,"seriesIndex"),a=n.get(s,"dataIndex");this.comp