Skip to content

Commit b3a56b4

Browse files
author
Martin Hansen
committed
Formatting
1 parent 246f329 commit b3a56b4

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Plotly.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,15 @@ export default {
126126
return Plotly.plot(this.$refs.container, this.data, this.internalLayout, this.options)
127127
},
128128
newPlot() {
129-
var el = this.$refs.container;
129+
var el = this.$refs.container
130+
let opts = this.options
130131
131-
//if width/height is not specified for toImageButton, default to el.clientWidth/clientHeight
132-
if(!this.options) this.options = {};
133-
if(!this.options.toImageButtonOptions) this.options.toImageButtonOptions = {};
134-
if(!this.options.toImageButtonOptions.width) this.options.toImageButtonOptions.width = el.clientWidth;
135-
if(!this.options.toImageButtonOptions.height) this.options.toImageButtonOptions.height = el.clientHeight;
136-
return Plotly.newPlot(this.$refs.container, this.data, this.internalLayout, this.options)
132+
// if width/height is not specified for toImageButton, default to el.clientWidth/clientHeight
133+
if (!opts) opts = {}
134+
if (!opts.toImageButtonOptions) opts.toImageButtonOptions = {}
135+
if (!opts.toImageButtonOptions.width) opts.toImageButtonOptions.width = el.clientWidth
136+
if (!opts.toImageButtonOptions.height) opts.toImageButtonOptions.height = el.clientHeight
137+
return Plotly.newPlot(this.$refs.container, this.data, this.internalLayout, opts)
137138
},
138139
react() {
139140
return Plotly.react(this.$refs.container, this.data, this.internalLayout, this.options)

0 commit comments

Comments
 (0)