Skip to content

Commit f67d6d3

Browse files
authored
Merge pull request #18 from soichih/master
Adjust png export size on resize
2 parents bddaa63 + bb6f810 commit f67d6d3

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)