fix: Incorrect hovered items in tooltips (#30405)

This commit is contained in:
Michael S. Molina
2024-09-26 16:08:59 -03:00
committed by GitHub
parent 0fdcd8b27e
commit 36f7a3f524
2 changed files with 13 additions and 11 deletions

View File

@@ -593,6 +593,7 @@ export default function transformProps(
extractForecastValuesFromTooltipParams(forecastValue);
const keys = Object.keys(forecastValues);
let focusedRow;
keys.forEach(key => {
const value = forecastValues[key];
// if there are no dimensions, key is a verbose name of a metric,
@@ -627,12 +628,11 @@ export default function transformProps(
: tooltipFormatterSecondary,
});
rows.push(row);
if (key === focusedSeries) {
focusedRow = rows.length - 1;
}
});
return tooltipHtml(
rows,
tooltipFormatter(xValue),
keys.findIndex(key => key === focusedSeries),
);
return tooltipHtml(rows, tooltipFormatter(xValue), focusedRow);
},
},
legend: {