From 4b275f2093954cc58bbc23e4fc67e67d6fe81c0b Mon Sep 17 00:00:00 2001 From: Riku <risaku@163.com> Date: 星期日, 13 七月 2025 22:46:35 +0800 Subject: [PATCH] 2025.7.13 污染动态溯源 --- src/components/chart/RealTimeLineChart.vue | 33 ++++++++++++++++++++++++++------- 1 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/components/chart/RealTimeLineChart.vue b/src/components/chart/RealTimeLineChart.vue index 562b60f..cc72183 100644 --- a/src/components/chart/RealTimeLineChart.vue +++ b/src/components/chart/RealTimeLineChart.vue @@ -1,6 +1,10 @@ <template> <div class="chart-wrap"> - <div ref="lineChart" class="line-chart"></div> + <div + ref="lineChart" + class="line-chart" + :style="'height:' + chartHeight + ';'" + ></div> </div> </template> <script> @@ -17,6 +21,16 @@ // series: [] // }; // } + }, + // 鎶樼嚎鍥惧睍绀洪珮搴� + chartHeight: { + type: String, + default: '140px' + }, + // 鎶樼嚎鍥綴杞村埢搴﹂棿璺� + yMinInterval: { + type: Number, + default: 1 } }, data() { @@ -37,13 +51,14 @@ refreshChart() { const { xAxis, series } = this.modelValue; if (!this.option) { - this.option = smallLineOption(xAxis, series); + this.option = smallLineOption(xAxis, series, this.yMinInterval); } else { this.option.xAxis[0].data = xAxis; this.option.series = series; } if (this.lineChart) { this.lineChart.setOption(this.option, { notMerge: true }); + // console.log('鎶樼嚎鍥剧敓鎴愶細绔嬪嵆'); } else { this.onChartCreated = () => { this.lineChart.setOption(this.option, { notMerge: true }); @@ -53,9 +68,13 @@ }, mounted() { this.lineChart = echarts.init(this.$refs.lineChart); - if (typeof this.onChartCreated === 'function') { - this.onChartCreated(); - } + this.onChartCreated(); + // setTimeout(() => { + // if (typeof this.onChartCreated === 'function') { + // this.onChartCreated(); + // // console.log('鎶樼嚎鍥剧敓鎴愶細婊炲悗'); + // } + // }, 500); } }; </script> @@ -66,8 +85,8 @@ justify-content: center; } .line-chart { - width: 300px; - height: 140px; + width: 318px; + /* height: 140px; */ /* border-bottom: 1px solid rgba(255, 255, 255, 0.329); */ } </style> -- Gitblit v1.9.3