From 98dd7b9d98dd68c19f914d245a0b41aa60f0cc3d Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Mon, 12 Jun 2023 21:04:43 +0200 Subject: [PATCH] [v10.0.x] Barchart: Fix tooltip for normal/percentage stacking (#69954) Barchart: Fix tooltip for normal/percentage stacking (#69931) (cherry picked from commit a4d8049999008c27e9e938496edb8833672cd475) Co-authored-by: Adela Almasan <88068998+adela-almasan@users.noreply.github.com> --- public/app/plugins/panel/barchart/bars.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/app/plugins/panel/barchart/bars.ts b/public/app/plugins/panel/barchart/bars.ts index b06b273f5a8..4da1b53454c 100644 --- a/public/app/plugins/panel/barchart/bars.ts +++ b/public/app/plugins/panel/barchart/bars.ts @@ -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; } }