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

Huge difference in performance

I am combining area charts with scatter charts. Initially I have 3 lines and two areas. It looks like this:

At some point I am deleting all three areas. I am using the following code:

 for (var i = 0; i <; i++) {
                        var trace =[i];
                        if (trace.fill === 'tozeroy') {
                            i = -1;

Plotly.relayout(div_chart, div_chart.layout);

It works fasts enough. But if I add two more subplots first:


then Plotly.relayout(div_chart, div_chart.layout); will take 7-8 secs.
I tried deleteTraces, the same.

Any help?


Cannot upload second image. :((((((((((