From a4b207ae33a42cde29239789d6d47ae5fcd2b634 Mon Sep 17 00:00:00 2001 From: marc Date: Sat, 30 Jul 2011 17:43:57 +0200 Subject: =?UTF-8?q?Revert=20"Add=20custom=20color=20support,=20detail=20sc?= =?UTF-8?q?ale=20from=20-10=20to=20100=C2=B0C"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit b05fa01a14831903c8c41a14a12ec68c55bde579. --- ebus/webapp/static/src/ebus.js | 58 +++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 37 deletions(-) (limited to 'ebus/webapp/static') diff --git a/ebus/webapp/static/src/ebus.js b/ebus/webapp/static/src/ebus.js index ae6ab29..ad98d91 100644 --- a/ebus/webapp/static/src/ebus.js +++ b/ebus/webapp/static/src/ebus.js @@ -7,32 +7,18 @@ $(document).ready(function(){ var plotOverview = null; var plotDetail = null; var indexFound = null; - var sensorList = [{"sensorname":"heizkreisregler9.solarDaten.tempKollektor","show":true, "color":"#f30000"}, - {"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":"heizkreisregler10.betriebsdatenRegler1.boilerTemperatur","show":true, "color":"#48b4ff"}]; - var pickSensorConfig = function(sensorname) { - $.each(sensorList, function(i,sensorconfig) { - var sensor_found; - if (sensorconfig.sensorname == sensorname) { - sensorconfig_found = sensorconfig; - return false; - } else { - sensorconfig_found = false; - } - }); - return sensorconfig_found; - } + var sensorList = [{"sensorname":"heizkreisregler9.solarDaten.tempKollektor","show":true}, + {"sensorname":"heizkreisregler10.betriebsdatenRegler1.kesselTemperatur","show":true}, + {"sensorname":"heizkreisregler9.solarDaten.tempWarmwasserSolar","show":false}, + {"sensorname":"feuerungsautomat1.betriebsdatenRegler1.aussenTemperatur","show":true}, + {"sensorname":"heizkreisregler10.betriebsdatenRegler1.boilerTemperatur","show":true}]; var replot = function() { if (plotDetail == null) { plotDetail = $.plot($("#ebusgraph"), datasetDetail, { xaxis: { mode: "time"}, - yaxis: { min: -10, max: 100 }, legend: { show : true} - }); } else { plotDetail.setData(datasetDetail); @@ -60,21 +46,20 @@ $(document).ready(function(){ } plotOverview.setSelection({xaxis: {'from': from*1000, 'to': to*1000}}, true); }; - var plotSensor = function(sensorconfig) { - plotSensorDetail(sensorconfig); - plotSensorOverview(sensorconfig); + var plotSensor = function(sensorname) { + plotSensorDetail(sensorname); + plotSensorOverview(sensorname); }; var unplotSensor = function(sensorname) { unplotSensorDetail(sensorname); unplotSensorOverview(sensorname); }; - var plotSensorDetail = function(sensorconfig) { - $.getJSON("sensor/"+escape(sensorconfig.sensorname)+"/"+from+"/"+to, + var plotSensorDetail = function(sensorname) { + $.getJSON("sensor/"+escape(sensorname)+"/"+from+"/"+to, function(response) { if (response['data']) { datasetDetail.push({'data':response['data'], - 'label':sensorconfig.sensorname, - 'color':sensorconfig.color}); + 'label':sensorname}); replot(); } else { alert("Fehler: " + response["error"]); @@ -92,13 +77,12 @@ $(document).ready(function(){ }); }; - var plotSensorOverview = function(sensorconfig) { - $.getJSON("sensor_cached/"+escape(sensorconfig.sensorname)+"/"+fromOverview, //+"/"+to, + var plotSensorOverview = function(sensorname) { + $.getJSON("sensor_cached/"+escape(sensorname)+"/"+fromOverview, //+"/"+to, function(response) { if (response['data']) { datasetOverview.push({'data':response['data'], - 'label':sensorconfig.sensorname, - 'color':sensorconfig.color}); + 'label':sensorname}); replotOverview(); } else { alert("Overview Fehler: " + response["error"]); @@ -138,17 +122,17 @@ $(document).ready(function(){ } }); - $.each(sensorList, function(i,sensorconfig) { - var pickerDiv = $("
").attr("id","pick_"+sensorconfig.sensorname.replace(/\./g,"_")) + $.each(sensorList, function(i,sensorname) { + var pickerDiv = $("
").attr("id","pick_"+sensorname.sensorname.replace(/\./g,"_")) .addClass("picker") .appendTo("#sensorpicker"); var pickerCheckbox = $("").attr("type","checkbox") .appendTo(pickerDiv); - $(pickerDiv).append(sensorconfig.sensorname); - if (sensorconfig.show) { + $(pickerDiv).append(sensorname.sensorname); + if (sensorname.show) { //Plot - plotSensor(sensorconfig); + plotSensor(sensorname.sensorname); $(pickerCheckbox).attr("checked","checked"); } }); @@ -157,8 +141,8 @@ $(document).ready(function(){ $('.picker input').click( function() { var sensorname = $(this).parent().attr("id").replace("pick_","").replace(/_/g,"."); - if ($(this).is(":checked")) { - plotSensor(pickSensorConfig(sensorname)); + if ($(this).is(":checked")) { + plotSensor(sensorname); } else { unplotSensor(sensorname); } -- cgit v1.2.1