TGraph slider question

From: Eddy Offermann (eddy@rentec.com)
Date: Fri Oct 02 1998 - 03:47:04 MEST


Hi Rooters,

I still did not figure out how to get the slider in the DrawPanel
working for a TGraph.

Rene Brun wrote:

> The TGraph::DrawPanel function is currently not implemented.
> I have added a message in the new version.
> Currently there are two ways to zoom on a graph:
> - via the command line by changing the pad range
> - drawing a TH1F empty object (setting min and max), then
>   drawing the graph on top and invoking DrawPanel on the TH1F object.

I like the second option because it seems only a few mouse clicks away.
So I tried the following macro:

{
   gROOT->Reset();
   c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);

   Int_t n = 10;
   Float_t x[n], y[n];
   for (Int_t i=0;i<n;i++) {
     x[i] = i*0.1;
     y[i] = x[i];
   }

   hpx = new TH1F("hpx","This is the px distribution",10,0,1);
   hpx->SetMinimum(0.0);
   hpx->SetMaximum(1.0);
   hpx->SetXTitle("X title");
   hpx->SetYTitle("Y title");
   hpx->Draw();

   gr = new TGraph(n,x,y);
   gr->SetLineColor(2);
   gr->SetMarkerColor(4);
   gr->SetMarkerStyle(21);
   gr->Draw("CP");
}

The DrawPanel works for 'hpx' but I lose the data points of the graph because
they do not get updated. Is there a statement, I should add ??

Best Regards,
Eddy Offermann



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:38 MET