summaryrefslogtreecommitdiff
path: root/ebus
diff options
context:
space:
mode:
authormarc <you@example.com>2011-07-25 23:37:42 +0200
committermarc <you@example.com>2011-07-25 23:37:42 +0200
commitb05fa01a14831903c8c41a14a12ec68c55bde579 (patch)
tree954bb56056184b1790538a35a77d8f373b53e689 /ebus
parentd2b172d047ef77c6f71fed26c32dcfe81911396d (diff)
downloadebus-alt-b05fa01a14831903c8c41a14a12ec68c55bde579.tar.gz
ebus-alt-b05fa01a14831903c8c41a14a12ec68c55bde579.zip
Add custom color support, detail scale from -10 to 100°C
Diffstat (limited to 'ebus')
-rw-r--r--ebus/webapp/static/src/ebus.js58
1 files changed, 37 insertions, 21 deletions
diff --git a/ebus/webapp/static/src/ebus.js b/ebus/webapp/static/src/ebus.js
index ad98d91..ae6ab29 100644
--- a/ebus/webapp/static/src/ebus.js
+++ b/ebus/webapp/static/src/ebus.js
@@ -7,18 +7,32 @@ $(document).ready(function(){
var plotOverview = null;
var plotDetail = null;
var indexFound = null;
- 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 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 replot = function() {
if (plotDetail == null) {
plotDetail = $.plot($("#ebusgraph"),
datasetDetail,
{
xaxis: { mode: "time"},
+ yaxis: { min: -10, max: 100 },
legend: { show : true}
+
});
} else {
plotDetail.setData(datasetDetail);
@@ -46,20 +60,21 @@ $(document).ready(function(){
}
plotOverview.setSelection({xaxis: {'from': from*1000, 'to': to*1000}}, true);
};
- var plotSensor = function(sensorname) {
- plotSensorDetail(sensorname);
- plotSensorOverview(sensorname);
+ var plotSensor = function(sensorconfig) {
+ plotSensorDetail(sensorconfig);
+ plotSensorOverview(sensorconfig);
};
var unplotSensor = function(sensorname) {
unplotSensorDetail(sensorname);
unplotSensorOverview(sensorname);
};
- var plotSensorDetail = function(sensorname) {
- $.getJSON("sensor/"+escape(sensorname)+"/"+from+"/"+to,
+ var plotSensorDetail = function(sensorconfig) {
+ $.getJSON("sensor/"+escape(sensorconfig.sensorname)+"/"+from+"/"+to,
function(response) {
if (response['data']) {
datasetDetail.push({'data':response['data'],
- 'label':sensorname});
+ 'label':sensorconfig.sensorname,
+ 'color':sensorconfig.color});
replot();
} else {
alert("Fehler: " + response["error"]);
@@ -77,12 +92,13 @@ $(document).ready(function(){
});
};
- var plotSensorOverview = function(sensorname) {
- $.getJSON("sensor_cached/"+escape(sensorname)+"/"+fromOverview, //+"/"+to,
+ var plotSensorOverview = function(sensorconfig) {
+ $.getJSON("sensor_cached/"+escape(sensorconfig.sensorname)+"/"+fromOverview, //+"/"+to,
function(response) {
if (response['data']) {
datasetOverview.push({'data':response['data'],
- 'label':sensorname});
+ 'label':sensorconfig.sensorname,
+ 'color':sensorconfig.color});
replotOverview();
} else {
alert("Overview Fehler: " + response["error"]);
@@ -122,17 +138,17 @@ $(document).ready(function(){
}
});
- $.each(sensorList, function(i,sensorname) {
- var pickerDiv = $("<div>").attr("id","pick_"+sensorname.sensorname.replace(/\./g,"_"))
+ $.each(sensorList, function(i,sensorconfig) {
+ var pickerDiv = $("<div>").attr("id","pick_"+sensorconfig.sensorname.replace(/\./g,"_"))
.addClass("picker")
.appendTo("#sensorpicker");
var pickerCheckbox = $("<input>").attr("type","checkbox")
.appendTo(pickerDiv);
- $(pickerDiv).append(sensorname.sensorname);
- if (sensorname.show) {
+ $(pickerDiv).append(sensorconfig.sensorname);
+ if (sensorconfig.show) {
//Plot
- plotSensor(sensorname.sensorname);
+ plotSensor(sensorconfig);
$(pickerCheckbox).attr("checked","checked");
}
});
@@ -141,8 +157,8 @@ $(document).ready(function(){
$('.picker input').click( function() {
var sensorname = $(this).parent().attr("id").replace("pick_","").replace(/_/g,".");
- if ($(this).is(":checked")) {
- plotSensor(sensorname);
+ if ($(this).is(":checked")) {
+ plotSensor(pickSensorConfig(sensorname));
} else {
unplotSensor(sensorname);
}