1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-16 00:00:03 +01:00
VILLASweb/app/controllers/visualization/index.js
Markus Grigull 8337550390 Add visualizations and plots
Plots can be added via drag'n'drop.
2016-06-28 14:23:49 +02:00

31 lines
851 B
JavaScript

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);
}
}
}
});