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
export default {
props: {
data: {
type: Array,
default: () => [],
},
},
data() {
return {
chart: null,
height: 270,
width: 0,
chartGeom: null,
};
},
watch: {
data() {
this.refreshData();
},
},
mounted() {
const innerWidth = window.innerWidth;
const innerHeight = window.innerHeight;
if (innerWidth < 1600) {
this.height = (innerHeight - 270) / 2;
}
this.width = this.$el.clientWidth;
this.initData();
},
methods: {
initData() {},
updateData() {},
refreshData() {
if (this.chart) {
this.chart.changeData(this.data);
this.chart.render();
this.updateData();
}
},
},
};