Skip to content

Commit 320c682

Browse files
author
Martin Hansen
committed
Replace all usages of newPlot
1 parent 2cdf6cd commit 320c682

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Plotly.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default {
8383
methods: {
8484
initEvents() {
8585
if (this.autoResize) {
86-
this.__resizeListener = debounce(this.newPlot, 200)
86+
this.__resizeListener = debounce(this.react, 200)
8787
window.addEventListener('resize', this.__resizeListener)
8888
}
8989
@@ -123,9 +123,9 @@ export default {
123123
return Plotly.downloadImage(this.$refs.container, opts)
124124
},
125125
plot() {
126-
return Plotly.plot(this.$refs.container, this.data, this.internalLayout, this.options)
126+
return Plotly.plot(this.$refs.container, this.data, this.internalLayout, this.getOptions())
127127
},
128-
newPlot() {
128+
getOptions() {
129129
let el = this.$refs.container
130130
let opts = this.options
131131
@@ -134,10 +134,13 @@ export default {
134134
if (!opts.toImageButtonOptions) opts.toImageButtonOptions = {}
135135
if (!opts.toImageButtonOptions.width) opts.toImageButtonOptions.width = el.clientWidth
136136
if (!opts.toImageButtonOptions.height) opts.toImageButtonOptions.height = el.clientHeight
137-
return Plotly.newPlot(this.$refs.container, this.data, this.internalLayout, opts)
137+
return opts
138+
},
139+
newPlot() {
140+
return Plotly.newPlot(this.$refs.container, this.data, this.internalLayout, this.getOptions())
138141
},
139142
react() {
140-
return Plotly.react(this.$refs.container, this.data, this.internalLayout, this.options)
143+
return Plotly.react(this.$refs.container, this.data, this.internalLayout, this.getOptions())
141144
}
142145
}
143146
}

0 commit comments

Comments
 (0)