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

Multiple responsive charts in same page

I’m following the example at https://plot.ly/javascript/responsive-fluid-layout/ to generate a responsive chart. It works well until I want to apply the exact same approach to multiple charts. When I do so, only the last one initialized actually gets a responsive behaviour.

So basically I do something like this:

where drawScatterPlot(idToPlotIn) is the same function as the example in https://plot.ly/javascript/responsive-fluid-layout/, with the addition of idToPlotIn as a parameter. Both charts are generated correctly, but only the last will be responsive.

Any ideas on what I’m doing wrong here? Thanks in advance!

this Responsive plotly.js was working, now it is not might help.