diff options
Diffstat (limited to 'ebus/webapp/static/ebus.js')
-rw-r--r-- | ebus/webapp/static/ebus.js | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/ebus/webapp/static/ebus.js b/ebus/webapp/static/ebus.js index e108f0a..15fe692 100644 --- a/ebus/webapp/static/ebus.js +++ b/ebus/webapp/static/ebus.js @@ -6,6 +6,7 @@ $(document).ready(function(){ var datasetOverview = []; var plotOverview = null; var plotDetail = null; + var indexFound = null; var replot = function() { if (plotDetail == null) { @@ -60,9 +61,18 @@ $(document).ready(function(){ } }); }; + var unplotSensorDetail = function(sensorname) { - + $.each(datasetDetail, function(i, sensor) { + alert(datasetDetail[i].label); + if (sensor.label == sensorname) { + indexFound = i; + } + }); + datasetDetail.splice(indexFound,1); + replot(); }; + var plotSensorOverview = function(sensorname) { $.getJSON("sensor_cached/"+escape(sensorname)+"/"+fromOverview, //+"/"+to, function(response) { @@ -76,6 +86,15 @@ $(document).ready(function(){ }); }; + var unplotSensorOverview = function(sensorname) { + $.each(datasetOverview, function(i, sensor) { + if (datasetOverview[i].label == sensorname) { + indexFound = i; + } + }); + datasetOverview.splice(indexFound,1); + replotOverview(); + } $("#overview").bind("plotselected", function (event, ranges) { range_from = Math.round(ranges.xaxis.from / 1000); @@ -103,12 +122,12 @@ $(document).ready(function(){ plotSensor("heizkreisregler10.betriebsdatenRegler1.kesselTemperatur"); plotSensor("feuerungsautomat1.betriebsdatenRegler1.aussenTemperatur"); // TODO http://people.iola.dk/olau/flot/examples/annotating.html - $('#button').click(function() { - $.each(datasetDetail, function(i, sensor) { - if (datasetDetail[i].label == "heizkreisregler9.solarDaten.tempKollektor") { - datasetDetail.splice(i,1); - replot(); - } - }); + + + $('#ausblenden').click(function() { + unplotSensor("heizkreisregler9.solarDaten.tempKollektor"); + }); + $('#einblenden').click(function() { + plotSensor("heizkreisregler9.solarDaten.tempKollektor"); }); }); |