Fixed fixed yaxis of stacked graph being cut off

This commit is contained in:
conorbroderick 2017-05-18 15:03:58 +01:00
parent b916b3784b
commit 9287a01bbf
2 changed files with 53 additions and 14 deletions

File diff suppressed because one or more lines are too long

View file

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