Merge branch 'dev/dynamicMaxTemp' into devel

This commit is contained in:
Nicanor Romero Venier 2015-10-05 16:04:08 +02:00
commit c050f6a467

View file

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