new graph

This commit is contained in:
Martin Donnelly 2016-08-15 15:32:21 +01:00
parent 3cfa66268b
commit a77d458eac
2 changed files with 17 additions and 6 deletions

View File

@ -29,6 +29,9 @@
console.log('model:all',d);
this.temporal = {low: 0,high: 0};
});
this.on('remove', function(){
$('#output').empty();
});
this.on('add',function() {
this.processAdded();
@ -122,8 +125,9 @@
_.bindAll(this, 'render', 'refresh', 'update');
this.collection.bind('change reset add remove', this.render, this);
this.template = _.template($('#list-template').html());
this.render();
//this.template = _.template($('#list-template').html());
this.template = _.template($('#loaded-template').html());
//this.render();
}, refresh: function() {
}, update: function() {
@ -136,8 +140,11 @@
}, render: function() {
console.log('MDOT:render');
$('#output').empty();
var that = this;
that.$el.append(this.template);
/* var that = this;
this.$el.empty();
this.collection.each(function(model) {
var events = model.get('events');
@ -147,7 +154,7 @@
that.$el.append(e);
});
console.log('bah');
console.log('bah');*/
return this;
}
});
@ -208,6 +215,7 @@
// this.collection.url = '/api/mdot/' + this.model.get('device');
this.collection.url = '/apiv2/mdot/' + this.model.get('device');
// this.collection.url = 'http://127.0.0.1:5984/mdot/_design/getDevice/_view/getDevice';
this.collection.fetch(fetchObj);
} else {
console.error('Nothing to get!');

View File

@ -21,7 +21,7 @@
<div id="graph">
</div>
<div id="output"></div>
</div>
<div class="mui-col-md-9">
@ -37,7 +37,10 @@
<!--<div id="main"></div>-->
<!--<div id="graph"></div>-->
<div id="output"></div>
<script type="text/template" id="loaded-template">
<div style="background-color: darkred;color: white;font-weight: 900;text-align: center">Loaded</div>
</script>
<script type="text/template" id="main-template">
<div class="mui-container">