1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Fixed #317 - Metric resist balance point is sometimes wrong

Added more precision to profile linear trendline generation.
This commit is contained in:
Jon Ziebell 2021-02-02 19:59:44 -05:00
parent d5e202c80b
commit e3a4e015e3
2 changed files with 5 additions and 2 deletions

View File

@ -960,8 +960,8 @@ class profile extends cora\api {
$intercept = (($sum_y) - ($slope * $sum_x)) / ($n);
return [
'slope' => round($slope, 2),
'intercept' => round($intercept, 2)
'slope' => round($slope, 4),
'intercept' => round($intercept, 4)
];
}
}

View File

@ -145,6 +145,9 @@ beestat.component.card.temperature_profiles.prototype.get_data_ = function() {
/**
* Get a linear trendline from a set of data.
*
* IMPORTANT: This exists in the profile already but it's wrong to use it
* directly as it's not right for Celsius.
*
* @param {Object} data The data; at least two points required.
*
* @return {Object} The slope and intercept of the trendline.