diff --git a/backend/lib/Interpreter/MeterInterpreter.php b/backend/lib/Interpreter/MeterInterpreter.php index 735b478..c822b85 100644 --- a/backend/lib/Interpreter/MeterInterpreter.php +++ b/backend/lib/Interpreter/MeterInterpreter.php @@ -31,6 +31,7 @@ namespace Volkszaehler\Interpreter; * */ use Volkszaehler; +use Volkszaehler\Util; class MeterInterpreter extends Interpreter { @@ -130,11 +131,12 @@ class MeterInterpreter extends Interpreter { $delta = $next[0] - $last[0]; return array( - (int) ($next[0] - $delta / 2), // timestamp + //(int) ($next[0] - $delta / 2), // timestamp + (float) ($next[0] - $delta / 2), // timestamp $next[1] * (3600000 / (($this->channel->getProperty('resolution')->getValue() / 1000) * $delta)), // value (isset($next[2])) ? $next[2] : 1 ); } } -?> \ No newline at end of file +?> diff --git a/backend/lib/View/JSON.php b/backend/lib/View/JSON.php index 4d34745..1c9946e 100644 --- a/backend/lib/View/JSON.php +++ b/backend/lib/View/JSON.php @@ -138,9 +138,11 @@ class JSON extends View { foreach ($data as $reading) { $jsonData[] = array( - (int) $reading[0], + //(int) $reading[0], + (float) $reading[0], (float) round($reading[1], View::PRECISSION), - (int) $reading[2] + //(int) $reading[2] + (float) $reading[2] ); } @@ -163,4 +165,4 @@ class JSON extends View { public function setPadding($padding) { $this->padding = $padding; } } -?> \ No newline at end of file +?> diff --git a/frontend/index.html b/frontend/index.html index b21806c..bc95eac 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -364,7 +364,8 @@ function getData() { $('#debug').append('json'); // load json data with given time window - $.getJSON("../backend/index.php/data/" + myUUID + '/format/json/from/'+myWindowStart+'/to/'+myWindowEnd, function(j){ + //$.getJSON("../backend/index.php/data/" + myUUID + '/format/json/from/'+myWindowStart+'/to/'+myWindowEnd, function(j){ + $.getJSON("../backend/index.php/data/" + myUUID + '?from='+myWindowStart+'&to='+myWindowEnd, function(j){ data = j; $('#debug').empty().append(data.toSource()); // then show/reload the chart @@ -376,18 +377,6 @@ function getData() { return false; } -function showInfos() { - - $('#ChartPlot').hide(); - $('#ChartInfo').show(); - - $('#ChartInfo').empty(); - - for(var i=0;i'); - } -} - function showChart() { var jqData = new Array(); @@ -421,7 +410,8 @@ function showChart() { // power (moving average) gray line //series_chart.push({showLabel:false,color:'#808080'}) - jqData.push(json2jqplot(data.channels[i].data)); + //jqData.push(json2jqplot(data.channels[i].data)); + jqData.push(data.channels[i].data); } jqOptions.axes = { yaxis:{autoscale:true, min:0, label:"Leistung (Watt)", tickOptions:{formatString:'%.3f'},labelRenderer: $.jqplot.CanvasAxisLabelRenderer}, @@ -454,14 +444,14 @@ function showChart() { });*/ } -function json2jqplot(raw) { +/*function json2jqplot(raw) { for(i=0;i