mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-16 00:00:03 +01:00
34 lines
632 B
JavaScript
34 lines
632 B
JavaScript
import Ember from 'ember';
|
|
|
|
export default Ember.Component.extend({
|
|
tagName: 'div',
|
|
classNames: ['line-chart'],
|
|
|
|
init: function() {
|
|
this._super();
|
|
this.addObserver('data', this.dataDidChange);
|
|
},
|
|
|
|
didInsertElement: function() {
|
|
this._drawPlot();
|
|
|
|
Ember.run.later(this, function() {
|
|
this._drawPlot();
|
|
}, 500);
|
|
},
|
|
|
|
dataDidChange: function() {
|
|
this._drawPlot();
|
|
},
|
|
|
|
_drawPlot: function() {
|
|
var elementId = this.get('elementId');
|
|
if (elementId) {
|
|
$.plot('#' + elementId, this.data);
|
|
}
|
|
|
|
Ember.run.later(this, function() {
|
|
this._drawPlot();
|
|
}, 500);
|
|
}
|
|
});
|