File tree 1 file changed +21
-9
lines changed
1 file changed +21
-9
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
- <div :id =" id" />
2
+ <div :id =" id" />
3
3
</template >
4
4
<script >
5
5
import Plotly from " plotly.js" ;
@@ -24,7 +24,7 @@ export default {
24
24
data () {
25
25
return {
26
26
internalLayout: { ... this .layout },
27
- needsReplot : true
27
+ scheduled : null
28
28
};
29
29
},
30
30
mounted () {
@@ -36,13 +36,19 @@ export default {
36
36
watch: {
37
37
data: {
38
38
handler () {
39
- this .scheduleRePlot ( );
39
+ this .schedule ({ reploat : true } );
40
40
},
41
41
deep: true
42
42
},
43
43
$attrs: {
44
44
handler () {
45
- this .scheduleRePlot ();
45
+ this .schedule ({ reploat: true });
46
+ },
47
+ deep: true
48
+ },
49
+ layout: {
50
+ handler () {
51
+ this .schedule ({ relayout: true });
46
52
},
47
53
deep: true
48
54
}
@@ -53,14 +59,20 @@ export default {
53
59
},
54
60
methods: {
55
61
... methods,
56
- scheduleRePlot () {
57
- if (this .needsReplot ) {
62
+ schedule (context ) {
63
+ const { scheduled } = this ;
64
+ if (scheduled) {
65
+ Object .assign (scheduled, context);
58
66
return ;
59
67
}
60
- this .needsReplot = true ;
68
+ this .scheduled = context ;
61
69
this .$nextTick (() => {
62
- this .newPlot ();
63
- this .needsReplot = false ;
70
+ const {
71
+ scheduled: { reploat , relayout }
72
+ } = this ;
73
+ reploat && this .newPlot ();
74
+ relayout && this .relayout ();
75
+ this .scheduled = null ;
64
76
});
65
77
},
66
78
toImage (options ) {
You can’t perform that action at this time.
0 commit comments