From 3db6cacf80f00ec7e6b37ba723e6a9d318f95447 Mon Sep 17 00:00:00 2001 From: Chris Wong Date: Sat, 8 Aug 2015 13:58:49 +1200 Subject: [PATCH] Make sure data are in order before displaying them If we don't do this, the plotting library draws "backwards" lines which looks ugly. Closes #16 --- assets/monitor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/monitor.js b/assets/monitor.js index 1361ad8..558334f 100644 --- a/assets/monitor.js +++ b/assets/monitor.js @@ -158,6 +158,9 @@ $(document).ready(function () { data[i].push([time, series[i].fn(stats, time, prev_stats, prev_time)]); + + // the data may arrive out-of-order, so sort by time stamp first + data[i].sort(function (a, b) { return a[0] - b[0]; }); } // zip legends with data