显示错位问题修复

This commit is contained in:
hey7845
2021-12-28 16:57:30 +08:00
parent 2068d9e872
commit 611f5b5e69

View File

@@ -64,7 +64,7 @@
<script> <script>
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { markRaw } from 'vue' let trendChart;
import { import {
getColumnOptions, getColumnOptions,
getTrendChart, getTrendChart,
@@ -83,10 +83,9 @@
areaList: ['南宁市'], areaList: ['南宁市'],
placeList: [], placeList: [],
regionLevel: '市级', // 区域等级 regionLevel: '市级', // 区域等级
xco: '年度' // 横坐标 xco: '区域/测点名称' // 横坐标
}, },
trendData: [], trendData: [],
chartColumn: null,
regionLevelOptions: [], regionLevelOptions: [],
placeOptions: [], placeOptions: [],
areaOptions: [], areaOptions: [],
@@ -190,24 +189,14 @@
}) })
}, },
initChart() { initChart() {
// const colors = ['#5470C6', '#91CC75', '#EE6666'];
this.trendData.yAxis[0].axisLabel = { this.trendData.yAxis[0].axisLabel = {
formatter: function (value) { return value.toFixed(1);}, formatter: function (value) { return value.toFixed(1);},
} }
// this.trendData.yAxis[0].axisLine = { if (trendChart != null && trendChart != "" && trendChart != undefined) {
// show: true, trendChart.dispose();// 销毁
// lineStyle: { }
// color: colors[0] trendChart = echarts.init(document.getElementById('chartColumn'))
// } let option = {
// }
// this.trendData.yAxis[1].axisLine = {
// show: true,
// lineStyle: {
// color: colors[1]
// }
// }
this.chartColumn = markRaw(echarts.init(document.getElementById('chartColumn')))
this.chartColumn.setOption({
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
@@ -228,7 +217,8 @@
xAxis: this.trendData.xAxis, xAxis: this.trendData.xAxis,
yAxis: this.trendData.yAxis, yAxis: this.trendData.yAxis,
series: this.trendData.series series: this.trendData.series
}) }
trendChart.setOption(option)
} }
} }