summaryrefslogtreecommitdiff
path: root/datastore-leveldb/wwwroot_ebus/src
diff options
context:
space:
mode:
Diffstat (limited to 'datastore-leveldb/wwwroot_ebus/src')
-rw-r--r--datastore-leveldb/wwwroot_ebus/src/ebus.js85
1 files changed, 50 insertions, 35 deletions
diff --git a/datastore-leveldb/wwwroot_ebus/src/ebus.js b/datastore-leveldb/wwwroot_ebus/src/ebus.js
index 862e24d..ae4c0e8 100644
--- a/datastore-leveldb/wwwroot_ebus/src/ebus.js
+++ b/datastore-leveldb/wwwroot_ebus/src/ebus.js
@@ -54,25 +54,18 @@ $(document).ready(function(){
"name":"feuerungsautomat1.betriebsdatenRegler1.aussenTemperatur",
"description":"Aussentemperatur (ebus)",
"values":Math.ceil(jQuery("#ebusgraph").width()/4),
- "show":true,
+ "show":false,
"lines":{fill: true, fillColor: "rgba(250, 250, 0, 0.2)"},
"color":"rgb(250,250,0)"
},
-{
- "name":"dockstar.load5",
- "description":"System Load (5m, *10)",
- "lines":{lineWidth:1},
- "show":false,
- "color":"blue",
- "mapFunc":function(d){return [d[0],d[1]*10]}
-},
-{
- "name":"dockstar.fs.ROOT",
- "description":"Rootfs free percent",
- "values":Math.ceil(jQuery("#ebusgraph").width()/16),
- "show":false,
- "color":"red"
-},
+//{
+// "name":"dockstar.load5",
+// "description":"System Load (5m, *10)",
+// "lines":{lineWidth:1},
+// "show":false,
+// "color":"blue",
+// "mapFunc":function(d){return [d[0],d[1]*10]}
+//},
{
"name":"heizkreisregler10.betriebsdatenRegler1.boilerTemperatur",
"description":"Boilertemperatur",
@@ -83,7 +76,7 @@ $(document).ready(function(){
{
"name":"de.wettermichel.temperature",
"description":"Aussentemperatur (wettermichel)",
- "show":false,
+ "show":true,
"values":Math.ceil(jQuery("#ebusgraph").width()/16),
"lines":{fill: true, fillColor: "rgba(132, 181, 0, 0.2)"},
"color":"#84b500"
@@ -106,6 +99,38 @@ var replot = function() {
plotDetail.getOptions().xaxes[0].max = timeToLocal(to);
plotDetail.setupGrid();
plotDetail.draw();
+
+ // insert legend
+ $("#ebusgraph").find(".legend").remove();
+ var fragments = [];
+ var legend = jQuery("<div>").addClass("legend").css({position: "absolute", right: "0px", top: "0px", background: "rgba(240,240,240,0.55)"});
+ var table = jQuery("<table>").appendTo(legend);
+ for (var i = 0; i < sensorConfigList.length; i++) {
+ var config = sensorConfigList[i];
+ var row = jQuery("<tr>");
+ var colorBox = jQuery("<td>").addClass("legendColorBox").appendTo(row);
+ var colorBoxBox = jQuery("<div>").css({background:config.color}).appendTo(colorBox);
+ var checkbox = jQuery("<input>").attr("type","checkbox").appendTo(colorBoxBox);
+ checkbox.attr("checked", config.show);
+ checkbox.css({opacity:0.6});
+ checkbox.data("name", config.name);
+ checkbox.click(function() {
+ var config = pickSensorConfig($(this).data("name"));
+ config.show = $(this).prop("checked");
+ if (config.show) {
+ plotSensor(config);
+ } else {
+ unplotSensor(config.name);
+ }
+ });
+
+ var label = jQuery("<td>").addClass("legendLabel").appendTo(row);
+ jQuery("<span>").text(sensorConfigList[i].description).appendTo(label);
+
+ table.append(row);
+ }
+ legend.appendTo($("#ebusgraph"));
+
};
var replotOverview = function() {
plotOverview.setData(datasetOverview);
@@ -208,8 +233,9 @@ plotDetail = $.plot($("#ebusgraph"),
frameRate: 16,
cursor:"move"
},
- legend: { show : true}
+ legend: { show : false }
});
+
$("#ebusgraph").bind('plotpan', function (event, plot) {
var axes = plot.getAxes();
plotOverview.setSelection({xaxis: {"from": Math.round(axes.xaxis.min), "to": Math.round(axes.xaxis.max)}}, true);
@@ -237,7 +263,7 @@ function update_range(range_from, range_to) {
return;
}
// max selection range
- if (range_to - range_from > d.month) {
+ if (range_to - range_from > 4*d.month) {
// reset selection
plotOverview.setSelection({xaxis: {"from": from, "to": to}}, true);
return;
@@ -263,29 +289,18 @@ $("#overview").bind("plotselected", function (event, ranges) {
});
$.each(sensorConfigList, function(i,sensorConfig) {
- var pickerDiv = $("<div>").addClass("picker").appendTo("#sensorpicker");
- var pickerCheckbox = $("<input>").attr("type","checkbox").appendTo(pickerDiv);
- pickerCheckbox.data("name", sensorConfig["name"]);
+ //var pickerDiv = $("<div>").addClass("picker").appendTo("#sensorpicker");
+ //var pickerCheckbox = $("<input>").attr("type","checkbox").appendTo(pickerDiv);
+ //pickerCheckbox.data("name", sensorConfig["name"]);
- $("<span>").text( sensorConfig.description + " (" + sensorConfig.sensorname + ")").appendTo(pickerDiv);
+ //$("<span>").text( sensorConfig.description + " (" + sensorConfig.sensorname + ")").appendTo(pickerDiv);
if (sensorConfig.show) {
//Plot
plotSensor(sensorConfig);
- $(pickerCheckbox).attr("checked","checked");
+ //$(pickerCheckbox).attr("checked","checked");
}
});
// TODO http://people.iola.dk/olau/flot/examples/annotating.html
-
-$(".picker input").click( function() {
- var sensorname = $(this).data("name");
- if ($(this).is(":checked")) {
- if (typeof console != "undefined") console.log(sensorname);
- plotSensor(pickSensorConfig(sensorname));
- } else {
- unplotSensor(sensorname);
- }
-});
-
});