needed to separate formatting temps from converting
dashboard was using format method to convert and send Fahrenheit values to chart, then passing the same method into chart formatter causing the Fahrenheit value to be passed in as Celsius and converted again.
This commit is contained in:
Rick Zaki
2025-01-09 14:27:26 -05:00
parent a58f9445c1
commit 50561f34ea
3 changed files with 45 additions and 21 deletions
@@ -159,9 +159,18 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy
for(const tempHistory of deviceSummary.temp_history){
const newDate = new Date(tempHistory.date);
let temperature;
switch (this.config.temperature_unit) {
case 'celsius':
temperature = tempHistory.temp;
break
case 'fahrenheit':
temperature = TemperaturePipe.celsiusToFahrenheit(tempHistory.temp)
break
}
deviceSeriesMetadata.data.push({
x: newDate,
y: TemperaturePipe.formatTemperature(tempHistory.temp, this.config.temperature_unit, false)
y: temperature
})
}
deviceTemperatureSeries.push(deviceSeriesMetadata)