[ROOT] zoomed in TGraph bug

From: Colley, Tony (Tony.Colley@itt.com)
Date: Tue Feb 26 2002 - 21:37:22 MET


The following demonstrates a "minor" bug in TGraph:

{
Int_t i;
Float_t x[1000];
Float_t y[1000];

for (i=0; i<1000; i++) 
{
   x[i] = 0.001*i;
   y[i] = 6.2831853*x[i];
   y[i] = sin(12*y[i]) + sin(17*y[i]) + sin(56*y[i]) + sin(74*y[i]);
}

TGraph *graph = new TGraph( 1000, x, y );
graph->Draw("AL");

printf(
"\n\n===============================================================\n" );
printf( "Right click on X axis and select SetRangeUser.\n" );
printf( "Enter the range 0.387 to 0.389 and click OK.\n" );
printf( "Move the cursor over one of the 3 points (at .387, .388, .389).\n"
);
printf( "Press down the left mouse button.\n" );
printf( "When I do it, there are 6 extra boxes drawn\n" );
printf( " (in addition to the three that should be drawn)\n" );
printf( "===============================================================\n"
);
}

(I've attached the same thing as tgdemo.C, in case that's easier to use than
just cutting/pasting from this email)

The y function was chosen arbitrarily. The bug appears for many other
functions I tried.

The bug is even more insidious when you significantly increase the number of
data points graphed. When you zoom in close enough to begin seeing
individual points, in addition to having many extra boxes, some boxes are
apparently drawn too close to the edges because there is a wraparound effect
(giving rectangles spanning the graph rather than little boxes around the
points).

I also noticed in the example I provided, if you don't zoom in quite so far,
there are extra boxes drawn extending out of the left and right sides of the
graph. These boxes seem to correspond to data points outside the graph
clipping area but within the canvas clipping area. I'm not sure if I would
classify this behaviour as a bug or a feature... it could be useful and may
be intentional (i.e. a feature).

Tony Colley
ITT Industries A/CD
Fort Wayne, IN  USA

Using ROOT 3.03/00, last updated from CVS on 18 Feb 2002, on RedHat Linux
7.2


************************************ 
If this email is not intended for you, or you are not responsible for the
delivery of this message to the addressee, please note that this message may
contain ITT Privileged/Proprietary Information.  In such a case, you may not
copy or deliver this message to anyone.  You should destroy this message and
kindly notify the sender by reply email.  Information contained in this
message that does not relate to the business of ITT is neither endorsed by
nor attributable to ITT. 
************************************ 

  






This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:43 MET