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

This commit is contained in:
Leon Sorokin 2023-05-25 14:25:26 -05:00 committed by GitHub
parent 37e2becdd7
commit 014126a43e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}