diff options
Diffstat (limited to 'ebus/webhdf/static/src')
-rw-r--r-- | ebus/webhdf/static/src/ebus.js | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/ebus/webhdf/static/src/ebus.js b/ebus/webhdf/static/src/ebus.js index ce37557..5c4fa16 100644 --- a/ebus/webhdf/static/src/ebus.js +++ b/ebus/webhdf/static/src/ebus.js @@ -11,7 +11,7 @@ d.now = new Date().getTime(); function int(n) { return Math.round(n); }; $(document).ready(function(){ - var from = d.now - 5*d.day; + var from = d.now - 1*d.day; var fromOverview = d.now - 30*d.day; var to = d.now; var datasetDetail = [] @@ -23,7 +23,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":false, "color":"#84b500"}, - {"sensorname":"de.wettermichel.temperature","show":true, "color":"#24f590"}, + // {"sensorname":"de.wettermichel.temperature","show":true, "color":"#24f590"}, {"sensorname":"heizkreisregler10.betriebsdatenRegler1.boilerTemperatur","show":true, "color":"#48b4ff"}]; var pickSensorConfig = function(sensorname) { @@ -40,7 +40,7 @@ $(document).ready(function(){ plotDetail = $.plot($("#ebusgraph"), datasetDetail, { - xaxis: { mode: "time", min: from, max:to }, + xaxis: { mode: "time", min: tzFix(from), max:tzFix(to) }, yaxis: { min: -16, max: 100 }, legend: { show : true} }); @@ -54,7 +54,7 @@ $(document).ready(function(){ lines: { show: true, lineWidth: 1 }, shadowSize: 0 }, - xaxis: { mode: "time", min: fromOverview, max: d.now }, + xaxis: { mode: "time", min: tzFix(fromOverview), max: tzFix(d.now) }, yaxis: { ticks: [], min: -26, max: 100, autoscaleMargin: 0.1 }, legend: { show: false }, selection: { mode: "x" } @@ -73,15 +73,16 @@ $(document).ready(function(){ unplotSensorDetail(sensorname); unplotSensorOverview(sensorname); }; - var tzFix = function(d) { - return d; //return d - new Date().getTimezoneOffset() * 60 * 1000; - } + var tzFix = function(d) { return d - new Date().getTimezoneOffset() * 60 * 1000; } + var tzUnfix = function(d) { return d + new Date().getTimezoneOffset() * 60 * 1000; } var plotSensorDetail = function(sensorConfig) { $.getJSON("sensor/"+escape(sensorConfig.sensorname)+"/"+int(from/1000)+"/"+int(to/1000), function(response) { if (!response.error) { - response.data = response.data.map(function(d) { return [ tzFix(d[0]), d[1] ]; }); + response.data = response.data.map(function(d) { + return [ tzFix(d[0]*1000), d[1] ]; + }); datasetDetail.push({'data':response['data'], 'label':sensorConfig.sensorname, 'color':sensorConfig.color}); @@ -106,7 +107,9 @@ $(document).ready(function(){ $.getJSON("avg/"+escape(sensorConfig.sensorname)+"/"+int(fromOverview/1000), function(response) { if (!response.error) { - response.data = response.data.map(function(d) { return [ tzFix(d[0]), d[1] ]; }); + response.data = response.data.map(function(d) { + return [ tzFix(d[0]*1000), d[1] ]; + }); datasetOverview.push({'data':response['data'], 'label':sensorConfig.sensorname, 'color':sensorConfig.color}); @@ -136,8 +139,8 @@ $(document).ready(function(){ plotOverview.setSelection({xaxis: {'from': from, 'to': to}}, true); return; } else { - from = range_from; - to = range_to; + from = tzUnfix( range_from ); + to = tzUnfix( range_to ); } sensors = []; for (elem in datasetOverview) { |