diff --git a/src/octoprint/static/js/app/viewmodels/temperature.js b/src/octoprint/static/js/app/viewmodels/temperature.js index e9f51ece..ee84612b 100644 --- a/src/octoprint/static/js/app/viewmodels/temperature.js +++ b/src/octoprint/static/js/app/viewmodels/temperature.js @@ -232,6 +232,8 @@ $(function() { var heaterOptions = self.heaterOptions(); if (!heaterOptions) return; + var maxTemps = [310/1.1]; + _.each(_.keys(heaterOptions), function(type) { if (type == "bed" && !self.hasBed()) { return; @@ -258,12 +260,31 @@ $(function() { color: pusher.color(heaterOptions[type].color).tint(0.5).html(), data: targets }); + + maxTemps.push(self.getMaxTemp(actuals, targets)); }); + self.plotOptions.yaxis.max = Math.max.apply(null, maxTemps) * 1.1; $.plot(graph, data, self.plotOptions); } }; + self.getMaxTemp = function(actuals, targets) { + var pair; + var maxTemp = 0; + actuals.forEach(function(pair) { + if (pair[1] > maxTemp){ + maxTemp = pair[1]; + } + }); + targets.forEach(function(pair) { + if (pair[1] > maxTemp){ + maxTemp = pair[1]; + } + }); + return maxTemp; + } + self.setTarget = function(item) { var value = item.newTarget(); if (!value) return;