Keep display properties when a histogram is updated

I have an application which is reading ROOT histograms from a remote server and is able to display them in TCanvas. Let’s suppose that a user for example opens one of the histograms in a standard TCanvas and then zooms it out. Shortly after that the application get an update for that histogram from the server. Is there a way of updating the content of the TCanvas with respect to the new version of the histogram but preserve all displaying options, like zoom factor, selected region, etc.?

Thanks in advance

just call canvas->Update()


Sorry, I was probably not clear enough. Histogram update is received as a distinct C++ object of the TH1 * type. That is not the same object as being displayed in the Canvas. I need to delete the old object (which is being displayed) and show the new one in the same Canvas with the same options.


Do something like:oldhist->Reset(); oldhist->Add(newhist); canvas->Modified(); canvas->Update();