diff --git a/database_format.json b/database_format.json index 3bd42a1..57cf95f 100644 --- a/database_format.json +++ b/database_format.json @@ -44,8 +44,8 @@ "category": "gps", "name": "Car speed (via GPS)", "unit": " mph", - "safe_max": null, - "safe_min": null + "safe_max": 100, + "safe_min": 0 }, "gps_course": { "category": "gps", diff --git a/main.py b/main.py index 2c8c5cf..3d81901 100644 --- a/main.py +++ b/main.py @@ -475,4 +475,4 @@ def longterm(): if __name__ == '__main__': - app.run(debug=True, use_reloader=False) + app.run(debug=True, use_reloader=False) \ No newline at end of file diff --git a/static/javascript/lib/Chart.js b/static/javascript/lib/Chart.js index abd8d41..8ab07fb 100644 --- a/static/javascript/lib/Chart.js +++ b/static/javascript/lib/Chart.js @@ -1444,11 +1444,11 @@ for (var func in conversions) { // export rgb2hsl and ["rgb"]["hsl"] convert[from] = convert[from] || {}; - convert[from][to] = convert[func] = (function(func) { + convert[from][to] = convert[func] = (function(func) { return function(arg) { if (typeof arg == "number") arg = Array.prototype.slice.call(arguments); - + var val = conversions[func](arg); if (typeof val == "string" || val === undefined) return val; // keyword @@ -1476,12 +1476,12 @@ Converter.prototype.routeSpace = function(space, args) { } // color.rgb(10, 10, 10) if (typeof values == "number") { - values = Array.prototype.slice.call(args); + values = Array.prototype.slice.call(args); } return this.setValues(space, values); }; - + /* Set the values for a space, invalidating cache */ Converter.prototype.setValues = function(space, values) { this.space = space; @@ -6463,7 +6463,7 @@ module.exports = { if (isHorizontal) { minSize = box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, horizontalBoxHeight); - maxChartAreaHeight -= minSize.height; + maxChartAreaHeight -= 0; } else { minSize = box.update(verticalBoxWidth, maxChartAreaHeight); maxChartAreaWidth -= minSize.width; diff --git a/static/javascript/map.js b/static/javascript/map.js index c6daf6b..e9e7b78 100644 --- a/static/javascript/map.js +++ b/static/javascript/map.js @@ -28,7 +28,7 @@ function on_select_change() { // map function draw_map() { - if(location_pairs === null) { + if(location_pairs == null) { document.getElementById("map").style.display = 'none'; document.getElementById("no-info").style.display = 'inline'; return; diff --git a/static/javascript/realtime.js b/static/javascript/realtime.js index 719b459..200aaf1 100644 --- a/static/javascript/realtime.js +++ b/static/javascript/realtime.js @@ -117,12 +117,11 @@ let charts = contexts.map(x => new Chart(x, { } })); - initialHide(); +initialScale(); checkForData(); setInterval(checkForData, 500); - /* Requests new data and calls updateChart() with it. */ @@ -141,6 +140,9 @@ function checkForData() { }); } +function getChartName(chart) { + return chart.canvas.id.split("-")[1]; +} function initialHide() { for (let chart of charts) { @@ -150,7 +152,16 @@ function initialHide() { } } +function initialScale(){ + for (let chart of charts){ + let name = getChartName(chart); + let info = db_format[name]; + chart.config.options.scales.yAxes[0].ticks.suggestedMax = info["safe_max"]; + chart.config.options.scales.yAxes[0].ticks.suggestedMin = info["safe_min"]; + + } +} /* Updates chart with values with new values(s) in new_data diff --git a/templates/daily_location.html b/templates/daily_location.html index 074d06b..f3c4822 100644 --- a/templates/daily_location.html +++ b/templates/daily_location.html @@ -4,7 +4,7 @@