|
@@ -9,6 +9,11 @@ export default {
|
9
|
9
|
props: [
|
10
|
10
|
'data',
|
11
|
11
|
],
|
|
12
|
+ data () {
|
|
13
|
+ return {
|
|
14
|
+ chart: undefined,
|
|
15
|
+ }
|
|
16
|
+ },
|
12
|
17
|
mounted() {
|
13
|
18
|
this.rander()
|
14
|
19
|
},
|
|
@@ -19,15 +24,20 @@ export default {
|
19
|
24
|
},
|
20
|
25
|
methods: {
|
21
|
26
|
rander() {
|
22
|
|
-
|
23
|
27
|
const _self = this
|
24
|
28
|
|
25
|
|
- var chart = new G2.Chart({
|
26
|
|
- container: 'node2',
|
27
|
|
- forceFit: true,
|
28
|
|
- height: 282,
|
29
|
|
- padding: [40, 'auto', 'auto', 'auto']
|
30
|
|
- })
|
|
29
|
+ if (this.chart) {
|
|
30
|
+ this.chart.clear();
|
|
31
|
+ } else {
|
|
32
|
+ this.chart = new G2.Chart({
|
|
33
|
+ container: 'node2',
|
|
34
|
+ forceFit: true,
|
|
35
|
+ height: 282,
|
|
36
|
+ padding: [40, 'auto', 'auto', 'auto']
|
|
37
|
+ })
|
|
38
|
+ }
|
|
39
|
+
|
|
40
|
+ const chart = this.chart;
|
31
|
41
|
|
32
|
42
|
chart.source(this.data, {
|
33
|
43
|
percent: {
|