Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed pin and hide #55

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions database_format.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,4 @@ def longterm():


if __name__ == '__main__':
app.run(debug=True, use_reloader=False)
app.run(debug=True, use_reloader=False)
10 changes: 5 additions & 5 deletions static/javascript/lib/Chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion static/javascript/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 13 additions & 2 deletions static/javascript/realtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -141,6 +140,9 @@ function checkForData() {
});
}

function getChartName(chart) {
return chart.canvas.id.split("-")[1];
}

function initialHide() {
for (let chart of charts) {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion templates/daily_location.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<script type="text/javascript">
// Declare Javascript variables and inject serverside values
// Pass list of location pairs for use in js map drawing
let location_pairs = {{ location_pairs}};
let location_pairs = {{ location_pairs }};

// Pass starttime and endtime, needed to set dropdowns on page reload
let starttime = {{ starttime }};
Expand Down