mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 06:04:05 -08:00
Fixed fixed yaxis of stacked graph being cut off
This commit is contained in:
parent
b916b3784b
commit
9287a01bbf
File diff suppressed because one or more lines are too long
|
@ -557,6 +557,21 @@ Prometheus.Graph.prototype.updateGraph = function() {
|
|||
});
|
||||
|
||||
// Find and set graph's max/min
|
||||
if (self.isStacked() === true) {
|
||||
// When stacked is toggled
|
||||
var max = 0;
|
||||
self.data.forEach(function(timeSeries) {
|
||||
var currSeriesMax = 0;
|
||||
timeSeries.data.forEach(function(dataPoint) {
|
||||
if (dataPoint.y > currSeriesMax && dataPoint.y != null) {
|
||||
currSeriesMax = dataPoint.y;
|
||||
}
|
||||
});
|
||||
max += currSeriesMax;
|
||||
});
|
||||
self.rickshawGraph.max = max*1.05;
|
||||
self.rickshawGraph.min = 0;
|
||||
} else {
|
||||
var min = Infinity;
|
||||
var max = -Infinity;
|
||||
self.data.forEach(function(timeSeries) {
|
||||
|
@ -576,6 +591,7 @@ Prometheus.Graph.prototype.updateGraph = function() {
|
|||
self.rickshawGraph.max = max + (0.1*(Math.abs(max - min)));
|
||||
self.rickshawGraph.min = min - (0.1*(Math.abs(max - min)));
|
||||
}
|
||||
}
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.Time({ graph: self.rickshawGraph });
|
||||
|
||||
|
|
Loading…
Reference in a new issue