Although I sent my question directly to Valery Fine, I think that your
comment may be interesting for rooters in general because I know people who
already asked me near the same question. I.e. what is the best way to
update your histograms on screen in on-line applications.
---------
Hi Valery,
thanks for the answer. It makes things clear, but still I have some more
specific question. Let's imagine I have an on-line application where an
user can define a set of canvas with histograms. There is also an
asin.timer set to update all the histograms once a second or so. Then I
have a loop inside UpdateTimer.Notify() which basically goes through all
the canvas and calls Hist[i]->Draw(); for each histogram. First at all it
may be a very time consuming, especially if I draw histograms with "fancy"
options like "cont" for 2D, etc. On the other hand a user can only view a
certain number of canvas/histograms at once. Moreover canvas can be
overlapped so that only a few histograms in canvas need to be actually
redrawn. What can you suggest in this case? Having in mind my experience
working with other winlibs starting from Borland TurboVision I know that
Object->Draw() checks if the Object is not hidden by other objects on the
screen. Then it goes through the actual drawing. Moreover it checks if its
children is not hidden before calling Children->Draw() for its Z buffer. In
root it seems that Hist->Draw() does much more than just drawing, while
Hist->Show() does similar things. The problem is that I have to use Draw()
to update histogram because its content is changing dynamically.
Dr. Anton Fokin
Division of Cosmic and Subatomic Physics
Lund University
Sweden
----------
> From: Rene Brun <brun@pcbrun.cern.ch>
> To: Anton Fokin <kosu_fokin@garbo.lucas.lu.se>
> Cc: roottalk@hpsalo.cern.ch
> Subject: Re: Draw histograms in Canvas
> Date: den 26 March 1999 15:27
>
> Hi Anton,
> Iconizing a canvas and back will not force a call to the TH1 drawing
> functions.
> The TCanvas::Update function is only called when the canvas content has
> been modified, or the scale of the canvas modified by growing/shrinking
> its dimensions with the mouse.
>
> Rene Brun
>
> On Fri, 26 Mar 1999, Anton Fokin wrote:
>
> > Hi rooters,
> >
> > I wonder if a histogram will be actually drawn (i.e. histogram->Draw()
will
> > consume the same amount of processor time and go through the the same
code)
> > if a Canvas is iconized/hidden/etc. Or it's my duty to check if a
histogram
> > is hidden and doesn't need to be redrawn. Also, if I go from an
iconized to
> > normal Canvas, will it force automatic redraw update for all histograms
> > belonging to the Canvas?
> >
> > Best regards,
> >
> > Dr. Anton Fokin
> >
> > Division of Cosmic and Subatomic Physics
> > Lund University
> > Sweden
> >
> >