Dynamically created layout overlapping

Hi, as the title says, I am having problems with my dynamically created layout overlapping each other.

I declare the layout as following


The graphs are generated according to a checklist, and there can be multiple graphs at the same time.
The histogram is generated using a button, using data from the graphs. What happens when I press that button is that the histogram will overlay over the graphs, instead of being placed right after the graphs

Is there any way to stop this from happening and get the correct behaviour?