Skip to content

Commit bb6f810

Browse files
author
Soichi Hayashi
committed
toImageButton defaults to 700x450 - ignoring container width/height.
this change sets the width/height to be the same size as the current plotly container size
1 parent bddaa63 commit bb6f810

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Plotly.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ export default {
118118
return Plotly.plot(this.$refs.container, this.data, this.internalLayout, this.options)
119119
},
120120
newPlot() {
121+
var el = this.$refs.container;
122+
123+
//if width/height is not specified for toImageButton, default to el.clientWidth/clientHeight
124+
if(!this.options) this.options = {};
125+
if(!this.options.toImageButtonOptions) this.options.toImageButtonOptions = {};
126+
if(!this.options.toImageButtonOptions.width) this.options.toImageButtonOptions.width = el.clientWidth;
127+
if(!this.options.toImageButtonOptions.height) this.options.toImageButtonOptions.height = el.clientHeight;
121128
return Plotly.newPlot(this.$refs.container, this.data, this.internalLayout, this.options)
122129
}
123130
}

0 commit comments

Comments
 (0)