|
@@ -39,7 +39,7 @@ export default {
|
|
|
},
|
|
|
data: []
|
|
|
},
|
|
|
- option: {
|
|
|
+ defOption: {
|
|
|
color: [
|
|
|
"#4ECDC4",
|
|
|
"#F72459",
|
|
@@ -102,12 +102,13 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
series: []
|
|
|
- }
|
|
|
+ },
|
|
|
+ newOption:{}
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.progressPie = this.$echarts.init(document.getElementById('ev-avg-compare'))
|
|
|
- this.progressPie.setOption(this.option)
|
|
|
+ // this.progressPie.setOption(this.newOption,true)
|
|
|
let erd11 = elementResizeDetectorMaker()
|
|
|
erd11.listenTo(document.getElementById("ev-avg-compare"), () => {
|
|
|
this.$nextTick(() => {
|
|
@@ -116,7 +117,7 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
this.progressPie.on('legendselectchanged', (params) => {
|
|
|
- let active = this.option.series.filter(item => {
|
|
|
+ let active = this.newOption.series.filter(item => {
|
|
|
if (params.selected[item.name]) {
|
|
|
return true
|
|
|
} else {
|
|
@@ -130,22 +131,22 @@ export default {
|
|
|
score[index] += scoreItem
|
|
|
})
|
|
|
})
|
|
|
- let len = this.option.series.length
|
|
|
- this.option.series[len - 1].data = score
|
|
|
- this.progressPie.setOption(this.option)
|
|
|
+ let len = this.newOption.series.length
|
|
|
+ this.newOption.series[len - 1].data = score
|
|
|
+ this.progressPie.setOption(this.newOption)
|
|
|
});
|
|
|
},
|
|
|
watch: {
|
|
|
pieData: {
|
|
|
handler(n, o) {
|
|
|
this.$nextTick(() => {
|
|
|
- let newOption = this._.cloneDeep(this.option)
|
|
|
+ this.newOption = this._.cloneDeep(this.defOption)
|
|
|
if (!this.progressPie) {
|
|
|
this.progressPie = this.$echarts.init(document.getElementById('ev-avg-compare'))
|
|
|
}
|
|
|
- // newOption.legend.data = []
|
|
|
+ //处理
|
|
|
this.pieData.forEach(item => {
|
|
|
- newOption.legend.data.push({
|
|
|
+ this.newOption.legend.data.push({
|
|
|
name: item.subjectId,
|
|
|
textStyle: {
|
|
|
color: '#FFF'
|
|
@@ -153,7 +154,7 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
if (this.pieData.length) {
|
|
|
- newOption.xAxis.data = this.pieData[0].className.map(item => {
|
|
|
+ this.newOption.xAxis.data = this.pieData[0].className.map(item => {
|
|
|
return item.name
|
|
|
})
|
|
|
}
|
|
@@ -173,7 +174,7 @@ export default {
|
|
|
|
|
|
}
|
|
|
this.pieData.forEach(item => {
|
|
|
- newOption.series.push(
|
|
|
+ this.newOption.series.push(
|
|
|
{
|
|
|
name: item.subjectId,
|
|
|
type: 'bar',
|
|
@@ -183,9 +184,9 @@ export default {
|
|
|
}
|
|
|
)
|
|
|
})
|
|
|
- newOption.series.push(this.defaultSeries)
|
|
|
- console.log('option哈哈',newOption)
|
|
|
- this.progressPie.setOption(newOption, true)
|
|
|
+ this.newOption.series.push(this.defaultSeries)
|
|
|
+ console.log('option哈哈',this.newOption)
|
|
|
+ this.progressPie.setOption(this.newOption, true)
|
|
|
})
|
|
|
},
|
|
|
deep: true,
|