From 99435df90dc63bbf9a3729826821fbd47677fb10 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Wed, 13 Mar 2024 11:09:10 +0800 Subject: [PATCH] fix:监测因子相关性对比折线图修改和走航报告下载修改 --- src/components/Echarts/LineChartSpe.vue | 52 +++++++++++++++++++++++++++++++++++----------------- 1 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/components/Echarts/LineChartSpe.vue b/src/components/Echarts/LineChartSpe.vue index 3f35afa..fb1af0e 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,18 @@ this.chart = null }, methods: { - initChart() { + initChart () { this.chart = echarts.init(this.$el, 'macarons') this.chart.clear() 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) + // }) let that = this - function fontSize(res) { + function fontSize (res) { let clientWidth = window.innerWidth || document.documentElement.clientWidth || @@ -145,18 +152,29 @@ color: 'rgb(255, 255, 255);', fontSize: fontSize(0.117), // ������������ lineHeight: 0 + }, + formatter: function (params) { + console.log('params', params) + let html = params[0].name + params.forEach((item, index) => { + html += (`<br/>${item.marker + item.seriesName}: ${item.value === undefined ? 0 : item.value}`) + }) + return html } }, yAxis: { + type: 'log', axisTick: { show: true, // ������������ }, axisLine: { - show: true, //��������������������� + show: true, // ��������������������� }, - axisLabel: { - show: true, //������������������������������ - } + // axisLabel: { + // formatter: function (value) { + // return value === 0.1 ? 0 : value + // } + // }, }, legend: { data: val.title, @@ -187,7 +205,7 @@ }, true ) - window.onresize = this.chart.resize + // window.onresize = this.chart.resize }, }, } -- Gitblit v1.8.0