Convert every remaining °C reference to the temp-unit toggle

The Machine Plan chart's axis ticks and first-crack band caption, the
print worksheet's axis title, and its "Your logged band" reference
column were all still hardcoded in °C. They're now data-driven
(data-tempc / data-band-lo / data-band-hi) and update alongside every
other temperature field when the unit is switched.
This commit is contained in:
2026-07-30 16:57:30 -04:00
parent 306d256832
commit 5a780cefa8
2 changed files with 46 additions and 16 deletions
+32 -16
View File
@@ -1395,7 +1395,14 @@
fill="var(--surface-raised)" fill="var(--surface-raised)"
/> />
<rect class="band" x="52" y="65.4" width="600" height="19.8" /> <rect class="band" x="52" y="65.4" width="600" height="19.8" />
<text x="58" y="62.4" class="bandline"> <text
x="58"
y="62.4"
class="bandline"
data-band-lo="176"
data-band-hi="187"
data-band-prefix="first-crack band, "
>
first-crack band, 176187 °C first-crack band, 176187 °C
</text> </text>
<g class="min"> <g class="min">
@@ -1452,15 +1459,15 @@
<line class="ax" x1="52" y1="24" x2="52" y2="294" /> <line class="ax" x1="52" y1="24" x2="52" y2="294" />
<line class="ax" x1="52" y1="294" x2="652" y2="294" /> <line class="ax" x1="52" y1="294" x2="652" y2="294" />
<line class="ax" x1="652" y1="24" x2="652" y2="294" /> <line class="ax" x1="652" y1="24" x2="652" y2="294" />
<g class="al" text-anchor="end"> <g class="al curve-axis-temp" text-anchor="end">
<text x="47" y="296.8">60</text> <text data-tempc="60" x="47" y="296.8">60</text>
<text x="47" y="260.8">80</text> <text data-tempc="80" x="47" y="260.8">80</text>
<text x="47" y="224.8">100</text> <text data-tempc="100" x="47" y="224.8">100</text>
<text x="47" y="188.8">120</text> <text data-tempc="120" x="47" y="188.8">120</text>
<text x="47" y="152.8">140</text> <text data-tempc="140" x="47" y="152.8">140</text>
<text x="47" y="116.8">160</text> <text data-tempc="160" x="47" y="116.8">160</text>
<text x="47" y="80.8">180</text> <text data-tempc="180" x="47" y="80.8">180</text>
<text x="47" y="44.8">200</text> <text data-tempc="200" x="47" y="44.8">200</text>
</g> </g>
<g class="al" text-anchor="middle"> <g class="al" text-anchor="middle">
<text x="52" y="304">0:00</text> <text x="52" y="304">0:00</text>
@@ -2019,7 +2026,7 @@
name="temps.charge.tempC" name="temps.charge.tempC"
/><span class="pv"></span> /><span class="pv"></span>
</td> </td>
<td class="num">133195 °C</td> <td class="num" data-band-lo="133" data-band-hi="195">133195 °C</td>
</tr> </tr>
<tr> <tr>
<td>Turning point</td> <td>Turning point</td>
@@ -2036,7 +2043,7 @@
name="temps.tp.tempC" name="temps.tp.tempC"
/><span class="pv"></span> /><span class="pv"></span>
</td> </td>
<td class="num">77100 °C @ 0:471:15</td> <td class="num" data-band-lo="77" data-band-hi="100" data-band-suffix=" @ 0:471:15">77100 °C @ 0:471:15</td>
</tr> </tr>
<tr> <tr>
<td>Yellow</td> <td>Yellow</td>
@@ -2049,7 +2056,7 @@
name="temps.yellow.tempC" name="temps.yellow.tempC"
/><span class="pv"></span> /><span class="pv"></span>
</td> </td>
<td class="num">148166 °C</td> <td class="num" data-band-lo="148" data-band-hi="166">148166 °C</td>
</tr> </tr>
<tr> <tr>
<td>First crack</td> <td>First crack</td>
@@ -2060,7 +2067,7 @@
name="temps.fc.tempC" name="temps.fc.tempC"
/><span class="pv"></span> /><span class="pv"></span>
</td> </td>
<td class="num">176187 °C</td> <td class="num" data-band-lo="176" data-band-hi="187">176187 °C</td>
</tr> </tr>
<tr> <tr>
<td>Drop</td> <td>Drop</td>
@@ -2071,7 +2078,7 @@
name="temps.drop.tempC" name="temps.drop.tempC"
/><span class="pv"></span> /><span class="pv"></span>
</td> </td>
<td class="num">183197 °C light</td> <td class="num" data-band-lo="183" data-band-hi="197" data-band-suffix=" light">183197 °C light</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -2158,7 +2165,15 @@
width="600" width="600"
height="19.8" height="19.8"
/> />
<text x="58" y="62.4" class="alr" style="font-size: 7px"> <text
x="58"
y="62.4"
class="alr"
style="font-size: 7px"
data-band-lo="176"
data-band-hi="187"
data-band-prefix="your first-crack band, "
>
your first-crack band, 176187 °C your first-crack band, 176187 °C
</text> </text>
<g class="min"> <g class="min">
@@ -2231,6 +2246,7 @@
class="ttl" class="ttl"
transform="rotate(-90 14 159)" transform="rotate(-90 14 159)"
text-anchor="middle" text-anchor="middle"
id="print-curve-axis-title"
> >
BEAN TEMP °C BEAN TEMP °C
</text> </text>
+14
View File
@@ -638,6 +638,20 @@ function updateTempUnitUI() {
if (printHeader) printHeader.textContent = label; if (printHeader) printHeader.textContent = label;
for (const input of document.querySelectorAll('#temp-unit-toggle input[name="tempUnit"]')) for (const input of document.querySelectorAll('#temp-unit-toggle input[name="tempUnit"]'))
input.checked = input.value === tempUnit; input.checked = input.value === tempUnit;
// Static reference numbers that live outside the plan (chart axes, band captions, the
// print worksheet's "Your logged band" column) — these are fixed constants, not plan
// data, so they're driven off data-tempc/data-band-lo/hi rather than valueForName().
const conv = (c) => Math.round(tempUnit === "F" ? cToF(c) : c);
for (const el of document.querySelectorAll("[data-tempc]"))
el.textContent = String(conv(Number(el.dataset.tempc)));
for (const el of document.querySelectorAll("[data-band-lo]")) {
const lo = conv(Number(el.dataset.bandLo));
const hi = conv(Number(el.dataset.bandHi));
el.textContent = `${el.dataset.bandPrefix ?? ""}${lo}${hi} ${label}${el.dataset.bandSuffix ?? ""}`;
}
const axisTitle = document.getElementById("print-curve-axis-title");
if (axisTitle) axisTitle.textContent = `BEAN TEMP ${label}`;
} }
function setTempUnit(unit) { function setTempUnit(unit) {