2015-12-10 21:30:37 +01:00
|
|
|
<h1 class="page-header">Overview</h1>
|
|
|
|
|
|
|
|
|
|
<div class="row placeholders">
|
|
|
|
|
<H1>Last 24 hours (kWh/5min)</H1>
|
2016-06-02 17:50:25 +02:00
|
|
|
<div id="minute-power-chart" style="height:450px;"></div>
|
2015-12-10 21:30:37 +01:00
|
|
|
</div>
|
|
|
|
|
<div class="row placeholders">
|
2015-12-11 23:19:17 +01:00
|
|
|
<H1>Last Week (kWh/h)</H1>
|
2016-06-02 17:50:25 +02:00
|
|
|
<div id="hour-power-chart" style="height:450px;"></div>
|
2015-12-10 21:30:37 +01:00
|
|
|
</div>
|
|
|
|
|
<div class="row placeholders">
|
2015-12-11 23:19:17 +01:00
|
|
|
<H1>All History (kWh/day)</H1>
|
2016-06-02 17:50:25 +02:00
|
|
|
<div id="day-power-chart" style="height:450px;"></div>
|
2015-12-10 21:30:37 +01:00
|
|
|
</div>
|
2016-02-09 12:43:28 +01:00
|
|
|
<div class="row placeholders">
|
|
|
|
|
<H1>All History (kWh/week)</H1>
|
2016-06-02 17:50:25 +02:00
|
|
|
<div id="week-power-chart" style="height:450px;"></div>
|
2016-02-09 12:43:28 +01:00
|
|
|
</div>
|
2015-12-10 21:30:37 +01:00
|
|
|
|
|
|
|
|
<script>
|
2016-06-02 17:50:25 +02:00
|
|
|
|
2015-12-10 21:30:37 +01:00
|
|
|
$(function(){
|
2016-06-02 17:50:25 +02:00
|
|
|
initChart("minute-power-chart", "?json&data=minute", 5*60*1000);
|
|
|
|
|
initChart("hour-power-chart", "?json&data=hour", 60*60*1000);
|
|
|
|
|
initChart("day-power-chart", "?json&data=day", -1);
|
|
|
|
|
initChart("week-power-chart", "?json&data=week", -1);
|
|
|
|
|
|
2015-12-11 17:31:13 +01:00
|
|
|
});
|
2016-06-01 11:14:58 +02:00
|
|
|
|
2016-06-02 17:50:25 +02:00
|
|
|
function initChart(elementId, url, time){
|
|
|
|
|
var chart = Morris.Line({
|
2015-12-10 21:30:37 +01:00
|
|
|
element: elementId,
|
2016-06-02 17:50:25 +02:00
|
|
|
data: [{time:0}],
|
2016-06-01 16:27:28 +02:00
|
|
|
xkey: 'time',
|
2016-06-02 17:50:25 +02:00
|
|
|
ykeys: [ {{#sensors}} {{.getId()}}, {{/sensors}} ],
|
2016-06-01 11:14:58 +02:00
|
|
|
labels: [ {{#sensors}} "{{.getUser().getUsername()}}: {{.getName()}}", {{/sensors}} ],
|
2015-12-10 21:30:37 +01:00
|
|
|
continuousLine: false,
|
|
|
|
|
pointSize: 1,
|
|
|
|
|
postUnits: 'kWh',
|
2016-05-27 16:36:24 +02:00
|
|
|
resize: true,
|
|
|
|
|
hideHover: 'auto',
|
2016-06-02 17:50:25 +02:00
|
|
|
});
|
|
|
|
|
updateChart(chart, url, time);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateChart(chart, url, time){
|
|
|
|
|
$.getJSON(url, function(json){
|
|
|
|
|
chart.setData(json.data);
|
|
|
|
|
});
|
|
|
|
|
if(time > 0)
|
|
|
|
|
setTimeout(function(){ updateChart(chart, url, time); }, time);
|
2015-12-10 21:30:37 +01:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|