Skip to content

Commit

Permalink
Replace all usages of newPlot
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Hansen committed Apr 25, 2019
1 parent 2cdf6cd commit 320c682
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Plotly.vue
Expand Up @@ -83,7 +83,7 @@ export default {
methods: {
initEvents() {
if (this.autoResize) {
this.__resizeListener = debounce(this.newPlot, 200)
this.__resizeListener = debounce(this.react, 200)
window.addEventListener('resize', this.__resizeListener)
}
Expand Down Expand Up @@ -123,9 +123,9 @@ export default {
return Plotly.downloadImage(this.$refs.container, opts)
},
plot() {
return Plotly.plot(this.$refs.container, this.data, this.internalLayout, this.options)
return Plotly.plot(this.$refs.container, this.data, this.internalLayout, this.getOptions())
},
newPlot() {
getOptions() {
let el = this.$refs.container
let opts = this.options
Expand All @@ -134,10 +134,13 @@ export default {
if (!opts.toImageButtonOptions) opts.toImageButtonOptions = {}
if (!opts.toImageButtonOptions.width) opts.toImageButtonOptions.width = el.clientWidth
if (!opts.toImageButtonOptions.height) opts.toImageButtonOptions.height = el.clientHeight
return Plotly.newPlot(this.$refs.container, this.data, this.internalLayout, opts)
return opts
},
newPlot() {
return Plotly.newPlot(this.$refs.container, this.data, this.internalLayout, this.getOptions())
},
react() {
return Plotly.react(this.$refs.container, this.data, this.internalLayout, this.options)
return Plotly.react(this.$refs.container, this.data, this.internalLayout, this.getOptions())
}
}
}
Expand Down

0 comments on commit 320c682

Please sign in to comment.