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/components/plot-container.js

58 lines
1.4 KiB
JavaScript
Raw Normal View History

2016-07-20 12:25:51 +02:00
/**
* File: plot-container.js
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
* Date: 05.07.2016
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
* Unauthorized copying of this file, via any medium is strictly prohibited.
**********************************************************************************/
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'div',
classNames: [ 'plots' ],
attributeBindings: [ 'style' ],
plots: null,
editing: false,
grid: true,
data: null,
style: Ember.computed('plots.@each.height', 'plots.@each.y', function() {
2016-07-27 13:43:10 +02:00
var height = this._calculateHeight();
if (this.get('editing') === true && height < 400) {
height = 400;
}
return Ember.String.htmlSafe('height: ' + height + 'px;');
}),
_value: Ember.computed('data.2.values.@each', function() {
console.log(this.get('data'));
}),
_calculateHeight() {
var maxHeight = 0;
var plots = this.get('plots');
plots.forEach(function(plot) {
var plotHeight = plot.get('y') + plot.get('height');
if (plotHeight > maxHeight) {
maxHeight = plotHeight;
}
});
// add padding to height
maxHeight += 40;
return maxHeight;
2016-10-12 11:29:09 +02:00
},
actions: {
showPlotDialog(plot) {
this.sendAction('showPlotDialog', plot);
}
}
});