diff --git a/htdocs/frontend/index.html b/htdocs/frontend/index.html index 43f4db9..c34e272 100644 --- a/htdocs/frontend/index.html +++ b/htdocs/frontend/index.html @@ -106,6 +106,7 @@   + diff --git a/htdocs/frontend/javascripts/options.js b/htdocs/frontend/javascripts/options.js index ab7200f..8e9d6ad 100644 --- a/htdocs/frontend/javascripts/options.js +++ b/htdocs/frontend/javascripts/options.js @@ -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 diff --git a/htdocs/frontend/javascripts/wui.js b/htdocs/frontend/javascripts/wui.js index 7e6bb9e..88b2f9d 100644 --- a/htdocs/frontend/javascripts/wui.js +++ b/htdocs/frontend/javascripts/wui.js @@ -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); diff --git a/lib/Interpreter/MeterInterpreter.php b/lib/Interpreter/MeterInterpreter.php index 8fc8ce8..06e9338 100644 --- a/lib/Interpreter/MeterInterpreter.php +++ b/lib/Interpreter/MeterInterpreter.php @@ -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 );