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:
parent
acebff7c0c
commit
5a84de89c0
4 changed files with 9 additions and 28 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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>
|
||||
-->
|
|
@ -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}}
|
||||
|
|
Loading…
Add table
Reference in a new issue