in reply to Graphs with tk
I will mention one thing, if you have too many datapoints, you may find it slow to display. You probably can get around it by updating your Canvas after every 100 points or so, so you will see the graph being drawn.
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Axis; # from Tk-Contrib-0.07 my $mw = MainWindow->new(); $mw->geometry("600x600+10+10"); #the axis widget is a canvas #the origin is in the upper left corner, #so the (0,0) point corresponds to (25,575) #in this example (600 - margin) my $axis = $mw->Axis( -background => 'white', -height => 600, -width => 600, -margin => 25, -tick => 10, #-tickfont => $tickfont, #-tst => $tst, #-width => $width, -xmin => 0, -xmax => 100, -ymin => 0, -ymax => 100, )->pack(); $axis->Tk::bind("<Button-1>", [ \&print_xy, Ev('x'), Ev('y') ]); MainLoop; sub print_xy { print "@_\n"; my ($canv, $x, $y) = @_; print "(x,y) = ", $canv->canvasx($x), ", ", $canv->canvasy($y), "\n" +; }
|
|---|