for (var s=0; s<data.length; s++)
{
var when = "";
- var dt = Date.parse(data[s].start+'T'+data[s].starttime);
- if (Date.now() > dt)
+ var stime = data[s].starttime;
+ var dt;
+ if (stime) {
+ dt = Date.parse(data[s].start+'T'+data[s].starttime);
+ } else {
+ dt = Date.parse(data[s].start);
+ }
+ if (stime && Date.now() > dt)
{
when = "JETZT";
}
else
{
var weekday = weekday2str((new Date(dt)).getDay());
- var stime = data[s].starttime;
var month = data[s].start.substring(5,7);
if (month[0] == '0')
month = month[1];
var dayofmonth = data[s].start.substring(8,10);
if (dayofmonth[0] == '0')
dayofmonth = dayofmonth[1];
- while (stime.substring(stime.length-3,stime.length) == ":00")
- {
- stime=stime.substring(0,stime.length-3);
+ if (stime) {
+ while (stime.substring(stime.length-3,stime.length) == ":00")
+ {
+ stime=stime.substring(0,stime.length-3);
+ }
+ if (stime.length <= 2) { stime+="h"; }
+ when = weekday + " " + dayofmonth+"."+month +", "+stime;
+ } else {
+ when = weekday + " " + dayofmonth+"."+month;
}
- if (stime.length <= 2) { stime+="h"; }
- when = weekday + " " + dayofmonth+"."+month +", "+stime;
}
data[s].when = when
}
function loadAndDrawSensorData() {
$.getJSON("https://realraum.at/shmcache/r3sensors.json", function(data){
drawLineGraph(document.getElementById('tempgooglegraph'), data["TempSensorUpdate"],
- {curveType: "function", title: 'Temperature Sensors', colors: ['#FF0000','#CC0033','#660000','#CC3333'], chartArea:{left:32,top:20,width:"88%",height:"83%"}, legend: {position: "none"}} ,true);
+ {curveType: "function", title: 'Temperature Sensors', colors: ['#FF0000','#CC0033','#660000','#CC3333'], vAxis:{viewWindow:{min:15,max:26}, viewWindowMode:"explicit"}, chartArea:{left:32,top:20,width:"88%",height:"78%"}, legend: {position: "none"}} ,true);
drawLineGraph(document.getElementById('lightgooglegraph'), data["IlluminationSensorUpdate"],
- {curveType: "none", title: 'Illumination Sensors', vAxis: {maxValue: 1024, minValue:5}, chartArea:{left:32,top:20,width:"88%",height:"83%"}, legend: {position: "none"}} ,true);
+ {curveType: "none", title: 'Illumination Sensors', vAxis: {maxValue: 1024, minValue:5}, chartArea:{left:32,top:20,width:"88%",height:"78%"}, legend: {position: "none"}} ,true);
drawLineGraph(document.getElementById('movementgooglegraph'), data["MovementSensorUpdate"],
- {curveType: "function", title: 'Movement Sensors', vAxis: {maxValue: 10, minValue:0}, chartArea:{left:32,top:20,width:"88%",height:"83%"}, legend: {position: "none"}} ,true);
+ {curveType: "function", title: 'Movement Sensors', vAxis: {maxValue: 10, minValue:0,viewWindowMode:"maximized"}, chartArea:{left:32,top:20,width:"88%",height:"78%"}, legend: {position: "none"}} ,true);
});
}