added "steps" display
this should much better represent the output from s0 electricity meters and water meters, where we get one impuls per energy or volume unit and (more important) the time interval depends on the throughput. this does not make much sense for temperature, though. unfortunately, we have currently no means to select different chart types depending on the entity type. also, I had to change the backend to output the starting time of the interval (flot needs that) instead of the ending time, which changes the "lines" chart. but since this chart is wrong for electricity and water anyway, it doesn't realy matter, though.
This commit is contained in:
parent
77fcc7cfb4
commit
98300a7aa0
4 changed files with 6 additions and 3 deletions
|
@ -106,6 +106,7 @@
|
|||
<td>
|
||||
<label for="render-points"><input type="radio" id="render-points" name="render" value="points" /> Punkte</label>
|
||||
<label for="render-lines"><input type="radio" id="render-lines" name="render" value="lines" /> Linien</label>
|
||||
<label for="render-steps"><input type="radio" id="render-steps" name="render" value="steps" /> Stufen</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -30,7 +30,7 @@ vz.options = {
|
|||
backendUrl: '../backend.php', // TODO default backend, store backend urls in cookies
|
||||
tuples: 300,
|
||||
precission: 2, // TODO update from backend capabilities?
|
||||
render: 'lines',
|
||||
render: 'steps',
|
||||
refresh: false,
|
||||
defaultInterval: 24*60*60*1000, // 1 day
|
||||
timezoneOffset: -(new Date().getTimezoneOffset() * 60000) // TODO add option with timezone dropdown
|
||||
|
|
|
@ -102,6 +102,7 @@ vz.wui.init = function() {
|
|||
// plot rendering
|
||||
$('#render-lines').attr('checked', (vz.options.render == 'lines'));
|
||||
$('#render-points').attr('checked', (vz.options.render == 'points'));
|
||||
$('#render-steps').attr('checked', (vz.options.render == 'steps'));
|
||||
$('input[name=render][type=radio]').change(function() {
|
||||
if ($(this).attr('checked')) {
|
||||
vz.options.render = $(this).val();
|
||||
|
@ -528,7 +529,8 @@ vz.wui.drawPlot = function () {
|
|||
$('#overlay').empty();
|
||||
}
|
||||
|
||||
vz.options.plot.series.lines.show = (vz.options.render == 'lines');
|
||||
vz.options.plot.series.lines.show = (vz.options.render == 'lines' || vz.options.render == 'steps');
|
||||
vz.options.plot.series.lines.steps = (vz.options.render == 'steps');
|
||||
vz.options.plot.series.points.show = (vz.options.render == 'points');
|
||||
|
||||
vz.plot = $.plot($('#flot'), data, vz.options.plot);
|
||||
|
|
|
@ -124,7 +124,7 @@ class MeterInterpreter extends Interpreter {
|
|||
|
||||
return array(
|
||||
//($next[0] - $delta / 2), // timestamp in the middle
|
||||
$next[0], // timestamp at the end
|
||||
$last[0], // timestamp at the start
|
||||
$next[1] * (3600000 / (($this->resolution / 1000) * $delta)), // value
|
||||
$next[2] // num of pulses
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue