diff --git a/pages/system.tsx b/pages/system.tsx index a452670..f83cc3c 100644 --- a/pages/system.tsx +++ b/pages/system.tsx @@ -44,7 +44,7 @@ const SystemPage = () => { const labels = history.map((h) => new Date(h.time).toLocaleTimeString()); - const formatValue = (value: number) => parseFloat(value.toFixed(2)); + const formatValue = (value: number) => value.toFixed(2); const voltageDatasets = [ { @@ -87,7 +87,7 @@ const SystemPage = () => { }, { label: "CPU Temp", - data: history.map((h) => h["CPU Temp"]), + data: history.map((h) => Number(formatValue(h["CPU Temp"]))), borderColor: "rgba(251,191,36,1)", backgroundColor: "rgba(251,191,36,0.5)", fill: false, @@ -122,6 +122,17 @@ const SystemPage = () => { legend: { position: "bottom" as const, }, + tooltip: { + callbacks: { + label: function (context: any) { + const label = context.dataset.label || ""; + const value = + context.parsed.y !== null ? context.parsed.y.toFixed(2) : ""; + const unit = label.includes("Temp") ? "°C" : "V"; + return `${label}: ${value} ${unit}`; + }, + }, + }, }, }; @@ -132,12 +143,18 @@ const SystemPage = () => {
{formatValue(value)}
-+ {formattedValue} {unit} +
+