1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-23 00:00:02 +01:00
VILLASweb/app/controllers/visualization/index.js

32 lines
851 B
JavaScript
Raw Normal View History

import Ember from 'ember';
export default Ember.Controller.extend({
plots: [],
actions: {
addPlot(name) {
var plot = null;
if (name === 'chart') {
// create new chart plot
plot = this.store.createRecord('plot', { name: 'Chart 1', signal: 'Signal 1' });
} else if (name === 'table') {
plot = this.store.createRecord('plot-table', { name: 'Table 1', signal: 'Signal 1', width: 500 });
} else if (name === 'value') {
plot = this.store.createRecord('plot', { name: 'Value 1', signal: 'Signal 1' });
} else {
// DEBUG
console.log('Add plot: ' + name);
return;
}
if (plot != null) {
// add plot to visualization
this.plots.pushObject(plot);
} else {
console.error('Unknown plot type: ' + name);
}
}
}
});