From 090db9401ce666ba47f8c83601885f9b26d3f7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 19 Dec 2016 09:30:52 +0100 Subject: [PATCH] fix(graph): fix for when data min/max delta is zero and negative and grid y min/max is auto, fixes #6980 --- public/vendor/flot/jquery.flot.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/public/vendor/flot/jquery.flot.js b/public/vendor/flot/jquery.flot.js index 8d61b3e9b28..e9feacafb84 100644 --- a/public/vendor/flot/jquery.flot.js +++ b/public/vendor/flot/jquery.flot.js @@ -1663,14 +1663,16 @@ 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) - min -= widen; + 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) - max += widen; + if (opts.max == null || opts.min != null) { + max += widen; + } } else { // consider autoscaling