Black Lives Matter. Please consider donating to Campaign Zero's mission of ending police violence in America.
https://www.joincampaignzero.org

Resize of Plotly chart

Hi

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() {
Plotly.Plots.resize(myDiv);
};

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.

Thanks
Nithya

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.