web/ui: avoid truncated Y-axis values (#6014)

* web/ui: avoid truncated Y-axis values

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Fix missing semi-colon

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2019-09-12 09:42:19 +02:00 committed by GitHub
parent 42d10aea80
commit 26e8d25e0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -738,13 +738,9 @@ Prometheus.Graph.prototype.updateGraph = function() {
}
});
});
if (min === max) {
self.rickshawGraph.max = max + 1;
self.rickshawGraph.min = min - 1;
} else {
self.rickshawGraph.max = max + (0.1*(Math.abs(max - min)));
self.rickshawGraph.min = min - (0.1*(Math.abs(max - min)));
}
var offset = 0.1 * (min === max ? max : Math.abs(max-min));
self.rickshawGraph.max = max + offset;
self.rickshawGraph.min = min - offset;
}
var xAxis = new Rickshaw.Graph.Axis.Time({ graph: self.rickshawGraph });