Plotly Vertical Legend Export Cut Off

I have a bar chart with lots of different series. There is a variable number of series. The legend has a scroll bar, because there are so many series. I want to export the bar chart. However, when I export the bar chart, the legend gets cut off and you can’t see all the series. Here is a CodePen of the issue. I’m not sure how to resolve the issue without calculating the height necessary to show all the series.