How to get graph from a TCanvas

Yes they all have the same name … too bad.
May be something similar to what is done in this HowTo can help: