提交 12183fcf 编写于 作者: WodahsOrez's avatar WodahsOrez

lxm--图表刷新bug修复

上级 df735a19
......@@ -307,9 +307,9 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char
let element:any = document.getElementById(this.chartId);
this.myChart = echarts.init(element);
}
this.handleChartOPtion(codelist);
console.log(this.chartOption);
this.myChart.setOption(this.chartOption);
let _chartOption = this.handleChartOPtion(codelist);
console.log(_chartOption);
this.myChart.setOption(_chartOption);
this.myChart.resize();
}
......@@ -319,6 +319,7 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char
* @memberof ${srfclassname('${ctrl.name}')}Base
*/
public handleChartOPtion(allcodelist:any){
let _chartOption:any = JSON.parse(JSON.stringify(this.chartOption));
if(Object.keys(this.seriesModel).length > 0){
let tempDataSourceMap:Map<string,any> = new Map();
for(let i=0;i<Object.keys(this.seriesModel).length;i++){
......@@ -330,12 +331,12 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char
}
if(tempDataSourceMap.size > 0){
tempDataSourceMap.forEach((item:any) =>{
this.chartOption.dataset.push({'source':item});
_chartOption.dataset.push({'source':item});
})
}
Object.keys(this.seriesModel).forEach((seriesName:string) =>{
if(this.chartOption && this.chartOption.series.length > 0){
this.chartOption.series.forEach((item:any) =>{
if(_chartOption && _chartOption.series.length > 0){
_chartOption.series.forEach((item:any) =>{
if(this.seriesModel[seriesName].ecxObject){
item = Util.deepObjectMerge(item,this.seriesModel[seriesName].ecxObject);
}
......@@ -351,25 +352,26 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char
let tempSeries:any = this.seriesModel[seriesName];
// 非雷达图
if(tempSeries && tempSeries.seriesIdField && tempSeries.seriesValues.length > 0 && !Object.is(tempSeries.type,'radar')){
const returnIndex:number = this.chartOption.series.findIndex((item:any) =>{
const returnIndex:number = _chartOption.series.findIndex((item:any) =>{
return Object.is(item.id,seriesName);
})
this.chartOption.series.splice(returnIndex,1);
_chartOption.series.splice(returnIndex,1);
let tempSeriesArray:Array<any> = [];
tempSeries.seriesValues.forEach((seriesvalueItem:any) =>{
let tempSeriesTemp:any = JSON.parse(JSON.stringify(tempSeries.seriesTemp));
<#noparse>Object.assign(tempSeriesTemp,{name:tempSeries.seriesMap[seriesvalueItem],datasetIndex:tempSeries.seriesIndex,encode:{x:tempSeries.categorField,y:`${seriesvalueItem}`}});</#noparse>
this.chartOption.series.push(tempSeriesTemp);
_chartOption.series.push(tempSeriesTemp);
})
}
})
}
if(Object.keys(this.chartBaseOPtion).length > 0){
Object.assign(this.chartOption,this.chartBaseOPtion);
Object.assign(_chartOption,this.chartBaseOPtion);
}
if(Object.keys(this.chartUserParams).length >0){
Object.assign(this.chartOption,this.chartUserParams);
Object.assign(_chartOption,this.chartUserParams);
}
return _chartOption;
}
/**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册