Black Lives Matter. Please consider donating to Black Girls Code today.

Resizing is not working after setting height in Plotly.relayout

Plotly.Plots.resize doesn’t seem to work after I set height useing Plotly.relayout method.
Demo: http://codepen.io/eagor/pen/EgWERX
If you comment out line 13, resizing will work just fine, but all the plotting is crammed into the initial height.
Not sure if it’s expected behaviour, but by setting only the height I would like the chart to respond to horizontal resizing. Is is possible to achive now?

It is the expected behavior as that relayout calls makes the graph have a fixed width and fixed width graph can’t be modified under Plotly.Plots.resize.

Here’s how: http://codepen.io/etpinard/pen/yabajo

1 Like

Thank you.

But in your example I can’t find where I set the height (on line 15 doesn’t work).

I need to set height manually to fit horizontal bar chart with large number of bars within little widget, keeping bars maintain same height. Here’s exact reproduction of my use case: http://codepen.io/eagor/pen/EgWERX (updated in question as well).
Or, maybe, there’s better way to do this?

Here’s a working example with a set height: http://codepen.io/etpinard/pen/KgvavA

1 Like

Legend!! Thank you!.

Applied to my example, in case somebody would need it: http://codepen.io/eagor/pen/xELaZY

Something happend to the relayout process.
It’s not showing correctly on initial render (only after window resize) on latest version.
Works well on 1.16.2 though (try to uncomment <script 1.16.2> tag.)
Also, I have some other issues with my other plots after latest update. Not sure if this should be separate thread, but my old code is broken with 1.18.0.

please submit a bug report to https://github.com/plotly/plotly.js/issues/new

thanks.

I was able to reproduce the problem.

I made a fix for in https://github.com/plotly/plotly.js/pull/1049

The problem will be fixed in plotly.js 1.18.1 set to be released tomorrow morning UTC-4