[v10.0.x] TimeSeries: Fix centeredZero y axis ranging when all values are 0 (#69112)

TimeSeries: Fix centeredZero y axis ranging when all values are 0 (#69034)

(cherry picked from commit 014126a43e)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2023-05-25 22:33:18 +03:00
committed by GitHub
co-authored by Leon Sorokin
parent 0b9cb47dd7
commit 2b7b737390
@@ -173,6 +173,12 @@ export class UPlotScaleBuilder extends PlotConfigBuilder<ScaleProps, Scale> {
let absMin = Math.abs(dataMin!);
let absMax = Math.abs(dataMax!);
let max = Math.max(absMin, absMax);
// flat 0
if (max === 0) {
max = 80;
}
dataMin = -max;
dataMax = max;
}