Skip to content

Instantly share code, notes, and snippets.

@flowck
Created August 1, 2019 22:33
Show Gist options
  • Save flowck/279b771dcc108f28d14e294fe1c8c3d0 to your computer and use it in GitHub Desktop.
Save flowck/279b771dcc108f28d14e294fe1c8c3d0 to your computer and use it in GitHub Desktop.
props: {
height: {
type: Number
}
},
methods: {
/**
* setSizes: Will set the width and height of the plot
*/
setSizes() {
// Object deconstruct to access the properties of margin
const { left, right, top, bottom } = this.margin;
const container = document.querySelector(".plot-container");
// Set the
this.size.width = container.offsetWidth - left - right;
this.size.height = this.height || container.offsetHeight - top - bottom;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment