-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrank-indicator-square-item.html
118 lines (108 loc) · 2.31 KB
/
frank-indicator-square-item.html
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../google-chart/google-chart.html">
<!--
Details of a indicator. Shows a title, a percent, a charts with
historic data.
Example:
<frank-indicator-square-item
title='Super Indicator'
percent='39.87'
data='[41,42,45,43,56,45,48,41,55,44,54,51,34,34,45,46,50]'>
</frank-indicator-square-item>
@demo
-->
<dom-module id="frank-indicator-square-item">
<link rel="import" type="css" href="frank-indicator-square-item.css">
<template>
<div>
<div class="title">{{title}}</div>
<div>
<frank-indicator-percent percent={{percent}}></frank-indicator-percent>
</div>
<div>
<google-chart
id="chart"
type="line"
options="{{options}}"
cols="{{cols}}"
rows="{{rows}}">
</google-chart>
</div>
</div>
<content></content>
</template>
</dom-module>
<script>
Polymer({
is: 'frank-indicator-square-item',
properties: {
/**
* Small description of the indicator. This despcription is displayed
* at the top of the component.
*
* @type string
*/
title: {
type: String,
value: 'Super indicator'
},
/**
* A percent value, shows how has changed a value of a indicator.
*
* @type Number
*/
percent: {
type: Number,
value: 39.76,
},
/**
* The historic with the values of the indicator in the past.
*
* @type Array
*/
values: {
type: Array,
value: [1, 2, 3]
},
options: {
type: Object,
notify: true
},
cols: {
type: Array,
notify: true
},
rows: {
type: Array,
notify: true
}
},
_values2rows: function() {
this.rows = [];
if(this.values instanceof Array) {
var count = this.values.length;
for (var i=0; i<count; i++) {
this.rows.push(['', this.values[i]]);
}
}
},
ready: function() {
this.options = {
legend: 'none',
hAxis: {
gridlines: {
color: 'white'
}
}
};
this.cols = [{
label: 'Data1',
type: 'string'
}, {
label: 'Value',
type: 'number'
}];
this._values2rows();
}
});
</script>