mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 10:52:47 +00:00
changes to graph and fixed time display on sensors page
This commit is contained in:
@@ -40,8 +40,6 @@ function resetCanvas(canvas_id, container_id){
|
|||||||
|
|
||||||
function displayChart(chart_id, chart_legend_id, year, month){
|
function displayChart(chart_id, chart_legend_id, year, month){
|
||||||
|
|
||||||
Chart.defaults.global.responsive = true;
|
|
||||||
|
|
||||||
var loc = $("#sensor-location").text();
|
var loc = $("#sensor-location").text();
|
||||||
loc = loc.split().join("+");
|
loc = loc.split().join("+");
|
||||||
|
|
||||||
@@ -75,8 +73,8 @@ function displayChart(chart_id, chart_legend_id, year, month){
|
|||||||
console.log(json);
|
console.log(json);
|
||||||
|
|
||||||
data.datasets.push({
|
data.datasets.push({
|
||||||
label: "Max Temperature",
|
label: "Max Temperature °F",
|
||||||
fillColor: "rgba(255,100,100,0.2)",
|
fillColor: "rgba(255,100,100,0)",
|
||||||
strokeColor: "rgba(255,100,100,1)",
|
strokeColor: "rgba(255,100,100,1)",
|
||||||
pointColor: "rgba(255,100,100,1)",
|
pointColor: "rgba(255,100,100,1)",
|
||||||
pointStrokeColor: "#fff",
|
pointStrokeColor: "#fff",
|
||||||
@@ -85,8 +83,8 @@ function displayChart(chart_id, chart_legend_id, year, month){
|
|||||||
data: []
|
data: []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Min Temperature",
|
label: "Min Temperature °F",
|
||||||
fillColor: "rgba(151,187,205,0.2)",
|
fillColor: "rgba(151,187,205,0)",
|
||||||
strokeColor: "rgba(151,187,205,1)",
|
strokeColor: "rgba(151,187,205,1)",
|
||||||
pointColor: "rgba(151,187,205,1)",
|
pointColor: "rgba(151,187,205,1)",
|
||||||
pointStrokeColor: "#fff",
|
pointStrokeColor: "#fff",
|
||||||
@@ -95,8 +93,8 @@ function displayChart(chart_id, chart_legend_id, year, month){
|
|||||||
data: []
|
data: []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Average Humidity",
|
label: "Average Humidity %",
|
||||||
fillColor: "rgba(200,200,200,0.2)",
|
fillColor: "rgba(200,200,200,0)",
|
||||||
strokeColor: "rgba(200,200,200,1)",
|
strokeColor: "rgba(200,200,200,1)",
|
||||||
pointColor: "rgba(200,200,200,1)",
|
pointColor: "rgba(200,200,200,1)",
|
||||||
pointStrokeColor: "#fff",
|
pointStrokeColor: "#fff",
|
||||||
@@ -116,7 +114,7 @@ function displayChart(chart_id, chart_legend_id, year, month){
|
|||||||
|
|
||||||
data.datasets[0].data.push(json[i].max);
|
data.datasets[0].data.push(json[i].max);
|
||||||
data.datasets[1].data.push(json[i].min);
|
data.datasets[1].data.push(json[i].min);
|
||||||
data.datasets[2].data.push(json[i].humidity);
|
data.datasets[2].data.push(Math.ceil(json[i].humidity));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get context with jQuery - using jQuery's .get() method.
|
// Get context with jQuery - using jQuery's .get() method.
|
||||||
@@ -148,7 +146,7 @@ Chart.defaults.global = {
|
|||||||
// easeInSine, easeOutExpo, easeOutCirc, easeOutCubic, easeInQuint,
|
// easeInSine, easeOutExpo, easeOutCirc, easeOutCubic, easeInQuint,
|
||||||
// easeInElastic, easeInOutSine, easeInOutQuint, easeInBounce,
|
// easeInElastic, easeInOutSine, easeInOutQuint, easeInBounce,
|
||||||
// easeOutElastic, easeInCubic]
|
// easeOutElastic, easeInCubic]
|
||||||
animationEasing: "easeOutQuart",
|
animationEasing: "easeOutCirc",
|
||||||
|
|
||||||
// Boolean - If we should show the scale at all
|
// Boolean - If we should show the scale at all
|
||||||
showScale: true,
|
showScale: true,
|
||||||
@@ -180,7 +178,7 @@ Chart.defaults.global = {
|
|||||||
scaleIntegersOnly: true,
|
scaleIntegersOnly: true,
|
||||||
|
|
||||||
// Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
|
// Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
|
||||||
scaleBeginAtZero: false,
|
scaleBeginAtZero: true,
|
||||||
|
|
||||||
// String - Scale label font declaration for the scale label
|
// String - Scale label font declaration for the scale label
|
||||||
scaleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
|
scaleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
|
||||||
@@ -195,7 +193,7 @@ Chart.defaults.global = {
|
|||||||
scaleFontColor: "#666",
|
scaleFontColor: "#666",
|
||||||
|
|
||||||
// Boolean - whether or not the chart should be responsive and resize when the browser does.
|
// Boolean - whether or not the chart should be responsive and resize when the browser does.
|
||||||
responsive: false,
|
responsive: true,
|
||||||
|
|
||||||
// Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
|
// Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
|
||||||
maintainAspectRatio: true,
|
maintainAspectRatio: true,
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ router.get('/', function(req, res, next) {
|
|||||||
|
|
||||||
info[i].info_link = info_link;
|
info[i].info_link = info_link;
|
||||||
|
|
||||||
|
//adjust minutes to show up correctly
|
||||||
|
if (minutes < 10){
|
||||||
|
minutes = "0" + minutes;
|
||||||
|
}
|
||||||
|
|
||||||
//converting 24 hours time to AM or PM
|
//converting 24 hours time to AM or PM
|
||||||
if (hours == 0){
|
if (hours == 0){
|
||||||
hours = 12;
|
hours = 12;
|
||||||
@@ -61,8 +66,6 @@ router.get('/', function(req, res, next) {
|
|||||||
info[i].connected = false;
|
info[i].connected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render('sensors', {query : info});
|
res.render('sensors', {query : info});
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<% include ../public/html/navbar.html %>
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="centerDiv">
|
<div class="centerDiv">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user