forked from patternfly/angular-patternfly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathempty-chart.component.js
More file actions
34 lines (32 loc) · 878 Bytes
/
Copy pathempty-chart.component.js
File metadata and controls
34 lines (32 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
*
* @description
* Directive for rendering an empty chart. This is used by chart directives when the data
* available flag is set to false.
*
* @param {string=} chartHeight height of the chart (no units) - default: 40
*/
angular.module('patternfly.charts').component('pfEmptyChart', {
bindings: {
chartHeight: '<?'
},
templateUrl: 'charts/empty-chart.html',
controller: function () {
'use strict';
var ctrl = this;
ctrl.setSizeStyles = function () {
var height = ctrl.chartHeight || 40;
var topPadding = Math.min(Math.round((height - 40) / 2), 20);
ctrl.sizeStyles = {
height: height + 'px',
'padding-top': topPadding + 'px'
};
};
ctrl.setSizeStyles();
ctrl.$onChanges = function (changesObj) {
if (changesObj.chartHeight) {
ctrl.setSizeStyles();
}
};
}
});