Skip to content

Commit

Permalink
Deactivating the energy data display (see issue #24)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamR1 committed Aug 21, 2017
1 parent 58f5186 commit d594142
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
11 changes: 6 additions & 5 deletions dapp/static/js/graph.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var ip = location.host;
var now = new Date().getTime();

var energyData = [];
Expand Down Expand Up @@ -72,8 +71,7 @@ function initData() {
}

function getData() {

$.getJSON("http://" + ip + "/get_data/", function (data) {
$.getJSON("/get_data/", function (data) {
var json = JSON.stringify(data.result);
var item = JSON.parse(json);
// var energy = [item.timestamp, item.value]; //data format [x, y]
Expand All @@ -82,6 +80,9 @@ function getData() {

if (energyData.length > totalPoints) {energyData.shift();}
energyData.push(energy);
})
.fail(function() {
console.log( "Error: getData failed (getJSON)" )
});
}

Expand All @@ -92,6 +93,6 @@ function update() {
}

$(document).ready(function () {
// initData();
// update();
initData();
update();
});
4 changes: 2 additions & 2 deletions dapp/static/js/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var jqxhr = $.getJSON("/getconfig/", function(data) {
var account = data.result.account;
var tokenAddress = data.result.token;
var contractAddress = data.result.daisee;
var Web3 = require('web3');
var Web3 = require("web3");
var web3 = new Web3();

web3.setProvider(new web3.providers.HttpProvider(nodeUrl));
Expand Down Expand Up @@ -127,4 +127,4 @@ var jqxhr = $.getJSON("/getconfig/", function(data) {
})
.fail(function() {
console.log( "Error: getconfig failed (getJSON)" );
})
});
12 changes: 6 additions & 6 deletions dapp/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ <h5>> Total production (Watt): <br><strong id="energyProduction"></strong></h5>
</div>

<div class="col-md-8">
<div class="chart-container">
<div id="flot-placeholder" style="width:auto;height:250px"></div>
<h5><center>Current consumption : <strong id="current">-</strong> W</center></h5>
</div>
<!-- <div class="chart-container">
<div id="flot-placeholder" style="width:auto;height:250px"></div>
<h5><center>Current consumption : <strong id="current">-</strong> W</center></h5>
</div> -->
</div>
</div>
</div> <!-- container -->
Expand Down Expand Up @@ -115,9 +115,9 @@ <h3 class="sub-header">Latest energy transactions <font size =4> (since <strong
<script src="static/js/token-abi.js"></script>
<script src="static/js/transactions.js"></script>

<script src="static/js/flot/jquery.flot.js"></script>
<!-- <script src="static/js/flot/jquery.flot.js"></script>
<script src="static/js/flot/jquery.flot.time.js"></script>
<script src="static/js/graph.js"></script>
<script src="static/js/graph.js"></script> -->

</body>

Expand Down

0 comments on commit d594142

Please sign in to comment.