hal/resource/web/pc_overview.tmpl

71 lines
1.8 KiB
Cheetah
Executable file

<h1 class="page-header">Overview</h1>
<div class="row placeholders">
<H1>Last 24 hours (kWh/5min)</H1>
<div id="min-power-chart" style="height:350px;"></div>
</div>
<div class="row placeholders">
<H1>Last Week (kWh/h)</H1>
<div id="hour-power-chart" style="height:350px;"></div>
</div>
<div class="row placeholders">
<H1>All History (kWh/day)</H1>
<div id="day-power-chart" style="height:350px;"></div>
</div>
<div class="row placeholders">
<H1>All History (kWh/week)</H1>
<div id="week-power-chart" style="height:350px;"></div>
</div>
<script>
$(function(){
chartData("min-power-chart",
[
{ time: (Date.now()-24*60*60*1000) },
{{#minData}}
{ time: {{.timestamp}}, "{{.id}}": {{.data}} },
{{/minData}}
{ time: Date.now() }
]
);
chartData("hour-power-chart",
[
{ time: (Date.now()-7*24*60*60*1000) },
{{#hourData}}
{ time: {{.timestamp}}, "{{.id}}": {{.data}} },
{{/hourData}}
{ time: Date.now() }
]
);
chartData("day-power-chart",
[{{#dayData}}
{ time: {{.timestamp}}, "{{.id}}": {{.data}} },
{{/dayData}}
{ time: Date.now() }
]
);
chartData("week-power-chart",
[{{#weekData}}
{ time: {{.timestamp}}, "{{.id}}": {{.data}} },
{{/weekData}}
{ time: Date.now() }
]
);
});
function chartData(elementId, data){
Morris.Line({
element: elementId,
data: data,
xkey: 'time',
ykeys: [ {{#sensors}} "{{.getId()}}", {{/sensors}} ],
labels: [ {{#sensors}} "{{.getUser().getUsername()}}: {{.getName()}}", {{/sensors}} ],
continuousLine: false,
pointSize: 1,
postUnits: 'kWh',
resize: true,
hideHover: 'auto',
});
}
</script>