From 3ea19f48fda159d7633f946d425649add7962646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=9D=B0?= Date: Mon, 18 Aug 2025 17:31:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=83=85=E7=BB=AA=E8=A7=A3=E7=A0=81=E5=99=A8?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E8=A7=A6=E5=8F=91=EF=BC=9B=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E8=A2=AB=E9=81=AE=E6=8C=A1=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/components/emotionDecod.vue | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/views/components/emotionDecod.vue b/src/views/components/emotionDecod.vue index 0fb13ee..1c9bc22 100644 --- a/src/views/components/emotionDecod.vue +++ b/src/views/components/emotionDecod.vue @@ -68,7 +68,8 @@ function initQXNLZHEcharts(kline, qxnlzhqData) { // 给配置项 const KlineOption = { tooltip: { - trigger: 'item', // 触发类型 坐标轴触发 + trigger: 'axis', // 触发类型 坐标轴触发 + confine: true, // 限制tooltip不超出容器 axisPointer: { type: 'cross', // 十字准星效果 crossStyle: { @@ -76,12 +77,18 @@ function initQXNLZHEcharts(kline, qxnlzhqData) { } }, formatter: function (params) { - const date = params.name + if (!params || params.length === 0) return '' + + // 找到K线数据 + const klineParam = params.find(param => param.seriesType === 'candlestick') + if (!klineParam) return '' + + const date = klineParam.name // 开收低高分别取参数的第2到第5个数 - const open = params.data[1] - const close = params.data[2] - const low = params.data[3] - const high = params.data[4] + const open = klineParam.data[1] + const close = klineParam.data[2] + const low = klineParam.data[3] + const high = klineParam.data[4] return `日期: ${date}
开盘价: ${open}
收盘价: ${close}
最低价: ${low}
最高价: ${high}` }