趋势图问题修复

This commit is contained in:
hey7845
2021-12-25 13:15:44 +08:00
parent fd6f04dedc
commit e04d95d7d9

View File

@@ -114,30 +114,39 @@
// 趋势图
drawTrend() {
getTrendChart(this.queryParams).then( res => {
this.trendData = res.data.data
this.chartColumn = markRaw(echarts.init(document.getElementById('chartColumn')))
this.chartColumn.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
console.log('res', res);
if (res.data.code == 0) {
this.trendData = res.data.data
this.initChart()
} else {
this.$message.error(res.data.msg)
}
})
},
initChart() {
echarts.init(document.getElementById("chartColumn")).dispose();
this.chartColumn = markRaw(echarts.init(document.getElementById('chartColumn')))
this.chartColumn.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
},
toolbox: {
feature: {
saveAsImage: {
show: true
}
}
},
toolbox: {
feature: {
saveAsImage: {
show: true
}
},
legend: this.trendData.legend,
xAxis: this.trendData.xAxis,
yAxis: this.trendData.yAxis,
series: this.trendData.series
})
}
},
legend: this.trendData.legend,
xAxis: this.trendData.xAxis,
yAxis: this.trendData.yAxis,
series: this.trendData.series
})
}
}