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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user