[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Gnome2::Canvas --> do I really need to worry about pixels_per_unit?



On Sun, 22 Jun 2008 20:20:33 -0700
walt <w41ter gmail com> wrote:

>The values of the data points vary widely, so the graph swings
>wildly beyond the top and bottom of the window as I scroll.
>
>To fix that I've been using $canvas->set_scroll_region to adjust
>the y axis with every horizontal scroll, and that *almost* works
>well enough, but not quite.
>
>The problem is that the vertical scroll region will just ignore
>any height value below some arbitrary limit.
>
>If the vertical range gets larger than some arbitrary limit, then
>I need to use the vertical scrollbar to be able to see the entire
>graph from top to bottom.
>
>The arbitrary max and min values for the scroll region seem to
>depend on the $canvas->units_per_pixel setting.  By changing the
>units_per_pixel I can make the scaling work correctly -- but I
>can't believe I need to go to that trouble to do something so
>simple as adjust the height of a graph.
>
>Are the tools really that limited -- or am I using the wrong
>tools for the job?

Could you post a small example where the data point can't
be scrolled to, and the "arbitrary limit" is hit?

It sounds to me like you have a predefined size set somewhere,
like a set_default_size in your mainwindow, or something.

I just posted a similar question recently, where my coordinates
seemed way off, and I couldn't explain it..... I figured it out as follows

################################
Doh!!!  Sorry I see the mistake. If the scrollregion is smaller than the default
canvas size, weird coordinate transforms occur. Maybe a bug?

$scroller->add( $canvas );                                                                
$window->add( $scroller );                                                                
$window->set_default_size( 500, 500 );                                                    
                                                                                          
#if scrollregion is smaller than default size, odd                                        
# coordinate problems occur                                                               
#$canvas->set_scroll_region( 0, 0, 400, 400 ); #bad                                   
                                                                                          
$canvas->set_scroll_region( 0, 0, 700, 700 );   #good and works fine

It would be a good "trick" question to throw at someone. :-)
########################################


See if that is it, otherwise post a minimal example.

zentara



-- 
I'm not really a human, but I play one on earth.
http://zentara.net/CandyGram_for_Mongo.html 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]