Commit 090db940 by Torkel Ödegaard

fix(graph): fix for when data min/max delta is zero and negative and grid y…

fix(graph): fix for when data min/max delta is zero and negative and grid y min/max is auto, fixes #6980
parent 3be77ad2
......@@ -1663,15 +1663,17 @@ Licensed under the MIT license.
// Grafana fix: wide Y min and max using increased wideFactor
// when all series values are the same
var wideFactor = 0.25;
var widen = max == 0 ? 1 : max * wideFactor;
var widen = Math.abs(max == 0 ? 1 : max * wideFactor);
if (opts.min == null)
if (opts.min == null) {
min -= widen;
}
// always widen max if we couldn't widen min to ensure we
// don't fall into min == max which doesn't work
if (opts.max == null || opts.min != null)
if (opts.max == null || opts.min != null) {
max += widen;
}
}
else {
// consider autoscaling
var margin = opts.autoscaleMargin;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment