Resize of Plotly chart


how to i resize plotly chart with specific height and width.

Below code will take the height and width automatically based on window height and width.
window.onresize = function() {

But i have the same functionality during the button click. It should take the parent div height and width. when ever the parent div height and width changes.


Using Plotly.relayout should do the trick:

var update = {
  width: 800,  // or any new width
  height: 500  // " "

Plotly.relayout('graph', update);

Hi Etienne,

Thank you so much its works for me.