mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-04 20:06:12 +02:00
UI: Skip restacking on hover in stacked series charts
See https://github.com/leeoniya/uPlot/issues/988 Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
parent
ac12e30f99
commit
2df86b24ad
@ -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 };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user