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

Add dataSet and options parameter to static-chart component and switch data sets on button press.
27 lines
574 B
JavaScript
27 lines
574 B
JavaScript
import Ember from 'ember';
|
|
|
|
export default Ember.Component.extend({
|
|
tagName: 'div',
|
|
classNames: ['line-chart'],
|
|
attributeBindings: ['style'],
|
|
xaxisLength: 300,
|
|
height: '100%',
|
|
data: [],
|
|
options: {},
|
|
|
|
didInsertElement: function() {
|
|
this._drawPlot();
|
|
},
|
|
|
|
style: function() {
|
|
return "height: " + this.get('height') + ";";
|
|
}.property('height'),
|
|
|
|
_drawPlot: function() {
|
|
var element = this.get('element');
|
|
if (element && element.id) {
|
|
// draw plot
|
|
$.plot('#' + element.id, this.get('data'), this.get('options'));
|
|
}
|
|
}.observes('data')
|
|
});
|