From f752f50a484f63fc3786ab1c7ad563f3b17cce77 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Fri, 15 Nov 2024 15:58:32 +0800 Subject: [PATCH] fix: 国控站 --- src/components/Echarts/LineChartSpe.vue | 50 +++++++++++++++++++++++++------------------------- 1 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/components/Echarts/LineChartSpe.vue b/src/components/Echarts/LineChartSpe.vue index 3f35afa..a7f10d6 100644 --- a/src/components/Echarts/LineChartSpe.vue +++ b/src/components/Echarts/LineChartSpe.vue @@ -1,17 +1,20 @@ <template> <!-- <div> --> <!-- <div>1111111111111111111111111111111111111111</div> --> - <div :class="className" :style="{ height: height, width: width }" /> + <div + :class="className" + :style="{ height: height, width: width }" + /> <!-- </div> --> </template> <script> -import * as echarts from 'echarts' -require('echarts/theme/macarons') // echarts theme -import resize from './mixins/resize' +import * as echarts from 'echarts' // echarts theme +// import resize from './mixins/resize' +require('echarts/theme/macarons') export default { - mixins: [resize], + // mixins: [resize], props: { className: { type: String, @@ -38,25 +41,25 @@ // required: true // } }, - data() { + data () { return { chart: null, } }, watch: { chartData: { - handler(val) { + handler (val) { this.setOptions(val) }, deep: true }, }, - mounted() { + mounted () { this.$nextTick(() => { this.initChart() }) }, - beforeDestroy() { + beforeDestroy () { if (!this.chart) { return } @@ -64,14 +67,21 @@ this.chart = null }, methods: { - initChart() { + initChart () { this.chart = echarts.init(this.$el, 'macarons') this.chart.clear() - this.setOptions(this.chartData) + // this.setOptions(this.chartData) }, - setOptions(val) { + setOptions (val) { + console.log('val,val', val) + // val.series.forEach(element => { + // element.data = element.data.map(item => item === 0 ? 0.1 : item) + // }) + if (this.chart) { + this.chart.clear() + } let that = this - function fontSize(res) { + function fontSize (res) { let clientWidth = window.innerWidth || document.documentElement.clientWidth || @@ -147,17 +157,7 @@ lineHeight: 0 } }, - yAxis: { - axisTick: { - show: true, // ������������ - }, - axisLine: { - show: true, //��������������������� - }, - axisLabel: { - show: true, //������������������������������ - } - }, + yAxis: val.yAxis, legend: { data: val.title, tooltip: { @@ -187,7 +187,7 @@ }, true ) - window.onresize = this.chart.resize + // window.onresize = this.chart.resize }, }, } -- Gitblit v1.8.0