趋势图问题修复

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() { drawTrend() {
getTrendChart(this.queryParams).then( res => { getTrendChart(this.queryParams).then( res => {
this.trendData = res.data.data console.log('res', res);
this.chartColumn = markRaw(echarts.init(document.getElementById('chartColumn'))) if (res.data.code == 0) {
this.chartColumn.setOption({ this.trendData = res.data.data
tooltip: { this.initChart()
trigger: 'axis', } else {
axisPointer: { this.$message.error(res.data.msg)
type: 'cross', }
crossStyle: { })
color: '#999' },
} 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: { toolbox: {
saveAsImage: { feature: {
show: true saveAsImage: {
} show: true
} }
}, }
legend: this.trendData.legend, },
xAxis: this.trendData.xAxis, legend: this.trendData.legend,
yAxis: this.trendData.yAxis, xAxis: this.trendData.xAxis,
series: this.trendData.series yAxis: this.trendData.yAxis,
}) series: this.trendData.series
}) })
} }
} }