From e3a4e015e36a1453a5d6fd84277cf58f499a1b59 Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Tue, 2 Feb 2021 19:59:44 -0500 Subject: [PATCH] Fixed #317 - Metric resist balance point is sometimes wrong Added more precision to profile linear trendline generation. --- api/profile.php | 4 ++-- js/component/card/temperature_profiles.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/profile.php b/api/profile.php index 3fc28c5..2e3641d 100644 --- a/api/profile.php +++ b/api/profile.php @@ -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) ]; } } diff --git a/js/component/card/temperature_profiles.js b/js/component/card/temperature_profiles.js index 0a58daa..c881a2c 100644 --- a/js/component/card/temperature_profiles.js +++ b/js/component/card/temperature_profiles.js @@ -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.