From e6632cb2ea45adf8d100bbaf82502c4ce1490302 Mon Sep 17 00:00:00 2001 From: pengmeng Date: Fri, 6 Jun 2025 09:55:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=8F=98=E5=8C=96-=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=87=8F=E8=83=BD=E8=BD=AC=E5=8C=96=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/components/emoEnergyConverter.vue | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/views/components/emoEnergyConverter.vue b/src/views/components/emoEnergyConverter.vue index da7b9e6..c325196 100644 --- a/src/views/components/emoEnergyConverter.vue +++ b/src/views/components/emoEnergyConverter.vue @@ -65,9 +65,9 @@ const generateGraphics = (min, max) => { function initQXNLZHEcharts(kline, qxnlzhqData) { // 测试数据 !!! 删掉 - // qxnlzhqData.topxh = ["2025/04/04", "2025/04/15"] - // qxnlzhqData.lowxh = ["2025/04/08", "2025/04/18"] - // qxnlzhqData.qixh = ["2025/04/10", "2025/04/21"] + qxnlzhqData.topxh = ["2025/04/04", "2025/04/15"] + qxnlzhqData.lowxh = ["2025/04/08", "2025/04/18"] + qxnlzhqData.qixh = ["2025/04/10", "2025/04/21"] if (qxnlzhqEchartsInstance) { qxnlzhqEchartsInstance.dispose(); } @@ -311,8 +311,8 @@ function initQXNLZHEcharts(kline, qxnlzhqData) { type: 'bar', stack: 'total', data: middleRangeData1, - barWidth: '10%', - barCategoryGap: '45%', + barWidth: '20%', + barCategoryGap: '40%', itemStyle: { normal: { color: 'rgba(0,0,0,0)' // 默认透明 @@ -326,8 +326,8 @@ function initQXNLZHEcharts(kline, qxnlzhqData) { type: 'bar', stack: 'total', data: middleRangeData, - barWidth: '10%', - barCategoryGap: '45%', + barWidth: '20%', + barCategoryGap: '40%', itemStyle: { normal: { color: 'rgba(0,0,0,0)' // 默认透明 @@ -424,6 +424,10 @@ function initQXNLZHEcharts(kline, qxnlzhqData) { }; // 应用配置 qxnlzhqEchartsInstance.setOption(option); + // 监听窗口大小变化,调整图表尺寸 + window.addEventListener('resize', () => { + qxnlzhqEchartsInstance.resize() + }) } onBeforeUnmount(() => { @@ -436,6 +440,6 @@ onBeforeUnmount(() => { \ No newline at end of file