Update data on legend change

Hi. I’m looking a solution of problem described here:
https://stackoverflow.com/questions/54202434/how-can-i-update-plotly-subplots-when-changing-traces
I’d appreciate any suggestions.

Thanks, Peter.

Cross reference How to use 'scatter.on_change' to grab event?