forked from trading-peter/chart-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chart-property-behavior.html
54 lines (47 loc) · 1.13 KB
/
chart-property-behavior.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
<script>
var ChartBehaviors = ChartBehaviors || {};
/** @polymerBehavior */
ChartBehaviors.ChartPropertyBehavior = Polymer.dedupingMixin(function(superClass) {
return class extends superClass {
static get properties() {
return {
type: {
type: String,
readOnly: true,
value: 'bar',
},
chart: {
notify: true
},
data: {
type: Object,
value: function () {
return {};
}
},
options: {
type: Object,
value: function () {
return {};
}
}
};
}
static get observers() {
return [
'_configurationChanged(data.*, options.*)'
];
}
_configurationChanged(dataRecord, optionsRecord) {
if (dataRecord.base.labels && dataRecord.base.datasets) {
this.hasData = true;
} else {
this.hasData = false;
}
if (this.hasData && this.isAttached) {
this._queue();
}
}
}
});
</script>