From 089e4145eca27ffe9dd2a657fa0cceb05483cb44 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Thu, 13 Apr 2023 16:23:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(AntV=E6=8A=98=E7=BA=BF=E5=9B=BE):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E7=BB=B4=E5=BA=A6=E4=B8=8B=E6=8C=87?= =?UTF-8?q?=E6=A0=87=E7=9A=84=E6=8F=90=E7=A4=BA=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/chart/common/common_antv.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/chart/chart/common/common_antv.js b/frontend/src/views/chart/chart/common/common_antv.js index bae3ce1b60..949381b507 100644 --- a/frontend/src/views/chart/chart/common/common_antv.js +++ b/frontend/src/views/chart/chart/common/common_antv.js @@ -364,7 +364,7 @@ export function getTooltip(chart) { res = valueFormatter(param.value, formatterItem) } } - } else if (includesAny(chart.type, 'bar', 'line', 'scatter', 'radar', 'area') && !chart.type.includes('group')) { + } else if (includesAny(chart.type, 'bar', 'scatter', 'radar', 'area') && !chart.type.includes('group')) { obj = { name: param.category, value: param.value } for (let i = 0; i < yAxis.length; i++) { const f = yAxis[i] @@ -377,6 +377,20 @@ export function getTooltip(chart) { break } } + } else if (chart.type === 'line') { + obj = { name: param.category, value: param.value } + const xAxisExt = JSON.parse(chart.xaxisExt) + for (let i = 0; i < yAxis.length; i++) { + const f = yAxis[i] + if (f.name === param.category || (yAxis.length && xAxisExt.length)) { + if (f.formatterCfg) { + res = valueFormatter(param.value, f.formatterCfg) + } else { + res = valueFormatter(param.value, formatterItem) + } + break + } + } } else if (chart.type.includes('group')) { if (chart.type === 'bar-group') { obj = { name: param.category, value: param.value }