Barchart: Fix tooltip for normal/percentage stacking (#69931)

This commit is contained in:
Adela Almasan 2023-06-12 13:56:20 -05:00 committed by GitHub
parent 228ae47653
commit a4d8049999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -493,12 +493,13 @@ export function getConfig(opts: BarsOptions, theme: GrafanaTheme2) {
let heightReduce = 0;
let widthReduce = 0;
const rect = hRect && findRect(qt, hRect.sidx - 1, hRect.didx);
// get height of bar rect at same index of the series below the hovered one
if (isStacked && isHovered && hRect!.sidx > 1) {
if (isStacked && isHovered && hRect!.sidx > 1 && rect) {
if (isXHorizontal) {
heightReduce = findRect(qt, hRect!.sidx - 1, hRect!.didx)!.h;
heightReduce = rect.h;
} else {
widthReduce = findRect(qt, hRect!.sidx - 1, hRect!.didx)!.w;
widthReduce = rect.w;
}
}