diff options
Diffstat (limited to 'ebus/webapp/static/src')
-rw-r--r-- | ebus/webapp/static/src/ebus.js | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/ebus/webapp/static/src/ebus.js b/ebus/webapp/static/src/ebus.js index 46a9ed8..64bbf6a 100644 --- a/ebus/webapp/static/src/ebus.js +++ b/ebus/webapp/static/src/ebus.js @@ -1,6 +1,14 @@ +var d = new Object(); +d.sec = 1; +d.min = 60 * d.sec; +d.hour = 60 * d.min; +d.day = 24 * d.hour; +d.week = 7 * d.day; +d.month = 30.5 * d.day; + $(document).ready(function(){ - var from = Math.round(new Date().getTime()/1000) - 24*60*60; //86400; - var fromOverview = Math.round(new Date().getTime()/1000) - 30*24*60*60; //86400; + var from = Math.round(new Date().getTime()/1000) - d.day; + var fromOverview = Math.round(new Date().getTime()/1000) - 15*d.day; var to = Math.round(new Date().getTime()/1000); var datasetDetail = [] var datasetOverview = []; @@ -11,6 +19,7 @@ $(document).ready(function(){ {"sensorname":"heizkreisregler10.betriebsdatenRegler1.kesselTemperatur","show":true, "color":"#283074"}, {"sensorname":"heizkreisregler9.solarDaten.tempWarmwasserSolar","show":false, "color":"#f0ff4c"}, {"sensorname":"feuerungsautomat1.betriebsdatenRegler1.aussenTemperatur","show":true, "color":"#84b500"}, + {"sensorname":"de.wettermichel.temperature","show":true, "color":"#24f590"}, {"sensorname":"heizkreisregler10.betriebsdatenRegler1.boilerTemperatur","show":true, "color":"#48b4ff"}]; var pickSensorConfig = function(sensorname) { @@ -29,7 +38,7 @@ $(document).ready(function(){ datasetDetail, { xaxis: { mode: "time"}, - yaxis: { min: -10, max: 100 }, + yaxis: { min: -16, max: 100 }, legend: { show : true} }); } else { @@ -48,7 +57,7 @@ $(document).ready(function(){ shadowSize: 0 }, xaxis: { mode: "time" }, - yaxis: { ticks: [], min: 0, max: 100, autoscaleMargin: 0.1 }, + yaxis: { ticks: [], min: -16, max: 100, autoscaleMargin: 0.1 }, legend: { show: false }, selection: { mode: "x" } }); @@ -96,7 +105,7 @@ $(document).ready(function(){ }; var plotSensorOverview = function(sensorConfig) { - $.getJSON("sensor_cached/"+escape(sensorConfig.sensorname)+"/"+fromOverview, //+"/"+to, + $.getJSON("sensor_cached/"+escape(sensorConfig.sensorname)+"/"+fromOverview, function(response) { if (response['data']) { response.data = response.data.map(function(d) { return [ tzFix(d[0]), d[1] ]; }); @@ -123,8 +132,8 @@ $(document).ready(function(){ $("#overview").bind("plotselected", function (event, ranges) { range_from = Math.round(ranges.xaxis.from / 1000); range_to = Math.round(ranges.xaxis.to / 1000); - // max selection range 14 days - if (range_to - range_from > 14 * 24 * 60 * 60) { + // max selection range + if (range_to - range_from > d.month/2) { plotOverview.setSelection({xaxis: {'from': from*1000, 'to': to*1000}}, true); return; } else { |