From 43145b8d951078d202367e9eee3f2a0bac67e4ae Mon Sep 17 00:00:00 2001 From: marc Date: Tue, 19 Jul 2011 23:29:19 +0200 Subject: Ein-/Ausblenden eines Datensatzes; Skalierung funktioniert beim Einblenden nicht --- ebus/webapp/static/ebus.js | 35 +++++++++++++++++++++++++++-------- ebus/webapp/static/index.html | 3 ++- 2 files changed, 29 insertions(+), 9 deletions(-) (limited to 'ebus/webapp/static') 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"); }); }); diff --git a/ebus/webapp/static/index.html b/ebus/webapp/static/index.html index e385865..7e2582d 100644 --- a/ebus/webapp/static/index.html +++ b/ebus/webapp/static/index.html @@ -9,6 +9,7 @@
-
ausblenden
+
ausblenden
+
einblenden
-- cgit v1.2.1