From e453e45b7f1c0a658b348e419364ee4bd6f452de Mon Sep 17 00:00:00 2001 From: Shadify Date: Mon, 11 Dec 2017 10:02:14 +0100 Subject: Sorted graph data --- src/AppBundle/Controller/AllDataAverageController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/AppBundle/Controller/AllDataAverageController.php b/src/AppBundle/Controller/AllDataAverageController.php index 439058a..87a9d7c 100644 --- a/src/AppBundle/Controller/AllDataAverageController.php +++ b/src/AppBundle/Controller/AllDataAverageController.php @@ -28,6 +28,10 @@ class AllDataAverageController extends Controller $readings = array(); + usort($data, function($a,$b){ + return $a['TimeStamp'] - $b['TimeStamp']; + }); + foreach($data as $index => $item) { -- cgit v1.2.3