From 2df86b24ad9e4da0fe30fc299b07b25fc7dc3ec7 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 4 Mar 2026 21:52:11 +0100 Subject: [PATCH] UI: Skip restacking on hover in stacked series charts See https://github.com/leeoniya/uPlot/issues/988 Signed-off-by: Julius Volz --- .../src/pages/query/uPlotStackHelpers.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/web/ui/mantine-ui/src/pages/query/uPlotStackHelpers.ts b/web/ui/mantine-ui/src/pages/query/uPlotStackHelpers.ts index ba9379bf69..90a03a3710 100644 --- a/web/ui/mantine-ui/src/pages/query/uPlotStackHelpers.ts +++ b/web/ui/mantine-ui/src/pages/query/uPlotStackHelpers.ts @@ -85,14 +85,16 @@ export function setStackedOpts(opts: uPlot.Options, data: uPlot.AlignedData) { }, }; - // restack on toggle + // restack on toggle (but not on focus/hover) opts.hooks = opts.hooks || {}; opts.hooks.setSeries = opts.hooks.setSeries || []; - opts.hooks.setSeries.push((u, _i) => { - const stacked = stack(data, (i) => !u.series[i].show); - u.delBand(null); - stacked.bands.forEach((b) => u.addBand(b)); - u.setData(stacked.data); + opts.hooks.setSeries.push((u, _i, opts) => { + if (opts.show != null) { + const stacked = stack(data, (i) => !u.series[i].show); + u.delBand(null); + stacked.bands.forEach((b) => u.addBand(b)); + u.setData(stacked.data); + } }); return { opts, data: stacked.data };