From b43874d1519d75c87f587db2564f883877ece1fa Mon Sep 17 00:00:00 2001 From: Magnus Persson Date: Mon, 14 Feb 2022 21:47:59 +0100 Subject: [PATCH] Sorting graph data --- html/calibration.htm | 4 ++++ test/formula.json | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/html/calibration.htm b/html/calibration.htm index 57a6999..a4ee866 100644 --- a/html/calibration.htm +++ b/html/calibration.htm @@ -274,6 +274,10 @@ function populateChartForm(a, g) { if( a != 0) chartDataForm.push( { x: parseFloat(a), y: parseFloat(g) }); + + chartDataForm.sort(function (a, b) { + return a.x - b.x; + }); } function populateChartCalc(a, g) { diff --git a/test/formula.json b/test/formula.json index fd53a8b..a8e095a 100644 --- a/test/formula.json +++ b/test/formula.json @@ -2,13 +2,13 @@ "gravity-formula": "0.00000166*tilt^3+-0.00024799*tilt^2+0.01344400*tilt+0.79358248", "angle": 45, "a1": 25, - "a2": 35, - "a3": 45, + "a3": 35, + "a2": 45, "a4": 55, "a5": 65, "g1": 1.000, - "g2": 1.010, - "g3": 1.025, + "g3": 1.010, + "g2": 1.025, "g4": 1.040, "g5": 1.060 } \ No newline at end of file