Fixed an error in the temp graph when not connected
This commit is contained in:
parent
ce4cf38547
commit
836fbef6d8
2 changed files with 8 additions and 4 deletions
|
|
@ -524,12 +524,14 @@ function formatFilament(filament) {
|
|||
}
|
||||
|
||||
function cleanTemperature(temp) {
|
||||
if (!temp || temp < 10) return gettext("off");
|
||||
if (temp === undefined || !_.isNumber(temp)) return "-";
|
||||
if (temp < 10) return gettext("off");
|
||||
return temp;
|
||||
}
|
||||
|
||||
function formatTemperature(temp, showF) {
|
||||
if (!temp || temp < 10) return gettext("off");
|
||||
if (temp === undefined || !_.isNumber(temp)) return "-";
|
||||
if (temp < 10) return gettext("off");
|
||||
if (showF) {
|
||||
return _.sprintf("%.1f°C (%.1f°F)", temp, temp * 9 / 5 + 32);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -363,9 +363,11 @@ $(function() {
|
|||
var p1 = series.data[i - 1];
|
||||
var p2 = series.data[i];
|
||||
|
||||
if (p1 == undefined) {
|
||||
if (p1 === undefined && p2 === undefined) {
|
||||
y = undefined;
|
||||
} else if (p1 === undefined) {
|
||||
y = p2[1];
|
||||
} else if (p2 == undefined) {
|
||||
} else if (p2 === undefined) {
|
||||
y = p1[1];
|
||||
} else {
|
||||
y = p1[1] + (p2[1] - p1[1]) * (pos.x - p1[0]) / (p2[0] - p1[0]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue