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 }