fix(AntV折线图): 修复多维度下指标的提示格式化不生效

This commit is contained in:
wisonic-s 2023-04-13 16:23:30 +08:00
parent b3e93a2a74
commit 089e4145ec

View File

@ -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 }