summaryrefslogtreecommitdiff
path: root/ebus/webapp/static
diff options
context:
space:
mode:
Diffstat (limited to 'ebus/webapp/static')
-rw-r--r--ebus/webapp/static/src/ebus.js58
1 files changed, 21 insertions, 37 deletions
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 = $("<div>").attr("id","pick_"+sensorconfig.sensorname.replace(/\./g,"_"))
+ $.each(sensorList, function(i,sensorname) {
+ var pickerDiv = $("<div>").attr("id","pick_"+sensorname.sensorname.replace(/\./g,"_"))
.addClass("picker")
.appendTo("#sensorpicker");
var pickerCheckbox = $("<input>").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);
}