File tree Expand file tree Collapse file tree 1 file changed +21
-9
lines changed Expand file tree Collapse file tree 1 file changed +21
-9
lines changed Original file line number Diff line number Diff line change 11<template >
2- <div :id =" id" />
2+ <div :id =" id" />
33</template >
44<script >
55import Plotly from " plotly.js" ;
@@ -24,7 +24,7 @@ export default {
2424 data () {
2525 return {
2626 internalLayout: { ... this .layout },
27- needsReplot : true
27+ scheduled : null
2828 };
2929 },
3030 mounted () {
@@ -36,13 +36,19 @@ export default {
3636 watch: {
3737 data: {
3838 handler () {
39- this .scheduleRePlot ( );
39+ this .schedule ({ reploat : true } );
4040 },
4141 deep: true
4242 },
4343 $attrs: {
4444 handler () {
45- this .scheduleRePlot ();
45+ this .schedule ({ reploat: true });
46+ },
47+ deep: true
48+ },
49+ layout: {
50+ handler () {
51+ this .schedule ({ relayout: true });
4652 },
4753 deep: true
4854 }
@@ -53,14 +59,20 @@ export default {
5359 },
5460 methods: {
5561 ... methods,
56- scheduleRePlot () {
57- if (this .needsReplot ) {
62+ schedule (context ) {
63+ const { scheduled } = this ;
64+ if (scheduled) {
65+ Object .assign (scheduled, context);
5866 return ;
5967 }
60- this .needsReplot = true ;
68+ this .scheduled = context ;
6169 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 ;
6476 });
6577 },
6678 toImage (options ) {
You can’t perform that action at this time.
0 commit comments