1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

Charts are live updated

The chart draw method is called every 500ms.
This commit is contained in:
Markus Grigull 2015-10-09 12:29:32 +02:00
parent acebff7c0c
commit 5a84de89c0
4 changed files with 9 additions and 28 deletions

View file

@ -11,6 +11,10 @@ export default Ember.Component.extend({
didInsertElement: function() {
this._drawPlot();
Ember.run.later(this, function() {
this._drawPlot();
}, 500);
},
dataDidChange: function() {
@ -20,5 +24,9 @@ export default Ember.Component.extend({
_drawPlot: function() {
var elementId = this.get('elementId');
$.plot('#' + elementId, this.data);
Ember.run.later(this, function() {
this._drawPlot();
}, 500);
}
});

View file

@ -8,11 +8,5 @@ export default Ember.Route.extend({
var record = this.store.peekRecord('property', params.property_id);
return record;
},
chartData: function() {
return {
name: 'test'
};
}.property()
}
});

View file

@ -1,10 +0,0 @@
<!-- {{#if data}}
<p>History: {{data.[0].length}}</p>
{{/if}}
<ul>
{{#each data.[0] as |sample|}}
<li>{{sample.[1]}}</li>
{{/each}}
</ul>
-->

View file

@ -1,12 +1 @@
{{#if model.name}}
<p>Model: {{model.name}}, {{model.history.[0].length}}</p>
{{/if}}
{{#if chartData}}
<p>{{chartData.name}}</p>
{{else}}
<p>No chart data</p>
{{/if}}
<!-- {{flot-chart height="500px" data=model.history}} -->
{{line-chart data=model.history}}