提交 e79c59a1 编写于 作者: tony001's avatar tony001

雷达图处理

上级 58cd77d6
...@@ -364,15 +364,14 @@ new ChartBarSeries({ ...@@ -364,15 +364,14 @@ new ChartBarSeries({
<#elseif item.getEChartsType() == "radar"> <#elseif item.getEChartsType() == "radar">
new ChartRadarSeries({ new ChartRadarSeries({
name:'${item.name?lower_case}', name:'${item.name?lower_case}',
type:'radar',
<#if item.getIdField()??>seriesIdField:"${item.getIdField()?lower_case}",</#if> <#if item.getIdField()??>seriesIdField:"${item.getIdField()?lower_case}",</#if>
<#if item.getSeriesField()??>seriesNameField:"${item.getSeriesField()?lower_case}",</#if> <#if item.getSeriesField()??>seriesNameField:"${item.getSeriesField()?lower_case}",</#if>
categorField:'${item.getCatalogField()?lower_case}', categorField:'${item.getCatalogField()?lower_case}',
<#if item.getCatalogPSCodeList()??><#assign categorCodeList = item.getCatalogPSCodeList() />categorCodeList:{type:'${categorCodeList.getCodeListType()}',tag:'${categorCodeList.getCodeName()}',emptycode:'empty',emptytext:'${categorCodeList.getEmptyText()}'},</#if> <#if item.getCatalogPSCodeList()??><#assign categorCodeList = item.getCatalogPSCodeList() />categorCodeList:{type:'${categorCodeList.getCodeListType()}',tag:'${categorCodeList.getCodeName()}',emptycode:'empty',emptytext:'${categorCodeList.getEmptyText()}'},</#if>
valueField:'${item.getValueField()?lower_case}', valueField:'${item.getValueField()?lower_case}',
seriesValues:[], seriesValues:[],
seriesIndex:${item.getIndex()},
data:[], data:[],
seriesMap:{},
<#if item.getPSChartDataSet()??> <#if item.getPSChartDataSet()??>
<#assign chartDataSet = item.getPSChartDataSet()/> <#assign chartDataSet = item.getPSChartDataSet()/>
<#if chartDataSet.getPSChartDataSetFields()??> <#if chartDataSet.getPSChartDataSetFields()??>
...@@ -383,74 +382,11 @@ new ChartRadarSeries({ ...@@ -383,74 +382,11 @@ new ChartRadarSeries({
], ],
</#if> </#if>
</#if> </#if>
ecxObject:{
<#-- 序列label start -->
<#if item.containsUserParam("ECX.label")>
label:${item.getUserParam("ECX.label")},
<#else>
label:{
show: true,
position: 'outside',
},
</#if>
<#-- 序列label end -->
<#-- 序列labelLine start -->
<#if item.containsUserParam("ECX.labelLine")>
labelLine:${item.getUserParam("ECX.labelLine")},
<#else>
labelLine:{
show: true,
length: 10,
lineStyle: {
width: 1,
type: 'solid'
}
},
</#if>
<#-- 序列labelLine end -->
<#-- 序列itemStyle start -->
<#if item.containsUserParam("ECX.itemStyle")>
itemStyle:${item.getUserParam("ECX.itemStyle")},
<#else>
itemStyle:{
borderColor: '#fff',
borderWidth: 1
},
</#if>
<#-- 序列itemStyle end -->
<#-- 序列emphasis start -->
<#if item.containsUserParam("ECX.emphasis")>
emphasis:${item.getUserParam("ECX.emphasis")},
<#else>
emphasis:{
label: {
fontSize: 20
}
}
</#if>
<#-- 序列emphasis end -->
},
ecObject:{
<#if item.getUserParamNames()??>
<#list item.getUserParamNames() as userparam>
<#if userparam?index_of("EC.")==0>
${userparam?remove_beginning("EC.")}:${item.getUserParam(userparam)},
</#if>
</#list>
</#if>
},
seriesTemp:{
type:'radar',
<#if item.getBaseOptionJOString()??>
${item.getBaseOptionJOString()}
</#if>
},
baseOption:{ baseOption:{
<#if item.getBaseOptionJOString()??> <#if item.getBaseOptionJOString()??>
${item.getBaseOptionJOString()} ${item.getBaseOptionJOString()}
</#if> </#if>
}, }
seriesLayoutBy:"${item.getSeriesLayoutBy()}"
}) })
<#else> <#else>
new ChartLineSeries({name:'${item.name?lower_case}',categorField:'${item.getCatalogField()?lower_case}',<#if item.getCatalogPSCodeList()??><#assign categorCodeList = item.getCatalogPSCodeList() />categorCodeList:{type:'${categorCodeList.getCodeListType()}',tag:'${categorCodeList.getCodeName()}'},</#if>valueField:'${item.getValueField()?lower_case}',data:[]}), new ChartLineSeries({name:'${item.name?lower_case}',categorField:'${item.getCatalogField()?lower_case}',<#if item.getCatalogPSCodeList()??><#assign categorCodeList = item.getCatalogPSCodeList() />categorCodeList:{type:'${categorCodeList.getCodeListType()}',tag:'${categorCodeList.getCodeName()}'},</#if>valueField:'${item.getValueField()?lower_case}',data:[]}),
......
...@@ -6,10 +6,8 @@ ${item.render.code} ...@@ -6,10 +6,8 @@ ${item.render.code}
id:'<#if item.getName()??>${item.getName()?lower_case}</#if>', id:'<#if item.getName()??>${item.getName()?lower_case}</#if>',
name:'<#if item.getCaption()??>${item.getCaption()}</#if>', name:'<#if item.getCaption()??>${item.getCaption()}</#if>',
type:'radar', type:'radar',
datasetIndex:${item.getIndex()},
seriesLayoutBy:"${item.getSeriesLayoutBy()}",
encode:{ encode:{
<#if item.getSeriesField()??>itemName:"${item.getSeriesField()}"</#if> <#if item.getCatalogField()??>itemName:"${item.getCatalogField()}"</#if>
}<#if item.getBaseOptionJOString()??>, }<#if item.getBaseOptionJOString()??>,
${item.getBaseOptionJOString()} ${item.getBaseOptionJOString()}
</#if> </#if>
......
...@@ -336,6 +336,16 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char ...@@ -336,6 +336,16 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char
} }
//设置多序列 //设置多序列
let tempSeries:any = this.seriesModel[seriesName]; let tempSeries:any = this.seriesModel[seriesName];
// 雷达图
if(tempSeries.type && Object.is(tempSeries.type,'radar') && tempSeries.seriesIdField && tempSeries.seriesValues.length > 0){
let tempIndicator:any = [];
tempSeries.seriesValues.forEach((item:any) =>{
let singleIndicatorObj:any = {name:item,max:100};
tempIndicator.push(singleIndicatorObj);
})
this.chartOption.radar = {'indicator':tempIndicator};
}else{
// 非雷达图
if(tempSeries && tempSeries.seriesIdField && tempSeries.seriesValues.length > 0){ if(tempSeries && tempSeries.seriesIdField && tempSeries.seriesValues.length > 0){
const returnIndex:number = this.chartOption.series.findIndex((item:any) =>{ const returnIndex:number = this.chartOption.series.findIndex((item:any) =>{
return Object.is(item.id,seriesName); return Object.is(item.id,seriesName);
...@@ -347,8 +357,7 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char ...@@ -347,8 +357,7 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char
<#noparse>Object.assign(tempSeriesTemp,{name:tempSeries.seriesMap[seriesvalueItem],datasetIndex:tempSeries.seriesIndex,encode:{x:tempSeries.categorField,y:`${seriesvalueItem}`}});</#noparse> <#noparse>Object.assign(tempSeriesTemp,{name:tempSeries.seriesMap[seriesvalueItem],datasetIndex:tempSeries.seriesIndex,encode:{x:tempSeries.categorField,y:`${seriesvalueItem}`}});</#noparse>
this.chartOption.series.push(tempSeriesTemp); this.chartOption.series.push(tempSeriesTemp);
}) })
}
} }
}) })
} }
...@@ -600,6 +609,13 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char ...@@ -600,6 +609,13 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char
}) })
} }
returnArray = this.sortReturnArray(returnArray,groupFieldModel,allCodeList); returnArray = this.sortReturnArray(returnArray,groupFieldModel,allCodeList);
// 雷达图数据格式处理
if(Object.is(item.type,'radar')){
returnArray.forEach((item:any) =>{
item.type = item[groupField[0]];
delete item[groupField[0]];
})
}
console.log(JSON.stringify(returnArray)); console.log(JSON.stringify(returnArray));
return returnArray; return returnArray;
} }
...@@ -632,6 +648,9 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char ...@@ -632,6 +648,9 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char
returnArray.push(item); returnArray.push(item);
} }
}) })
returnArray.forEach((item:any) =>{
delete item.hasused;
})
}else{ }else{
// 分组为年份 // 分组为年份
if(Object.is(groupField[0].groupMode,"YEAR")){ if(Object.is(groupField[0].groupMode,"YEAR")){
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册