NAME

Chart::Plot::Canvas - Plot two dimensional data in an Tk Canvas.

SYNOPSIS

use Chart::Plot::Canvas;

my $img = Chart::Plot::Canvas->new();
my $anotherImg = Chart::Plot::Canvas->new ($image_width, $image_height);

$img->setData (\@dataset) or die( $img->error() );
$img->setData (\@xdataset, \@ydataset);
$img->setData (\@anotherdataset, 'red_dashedline_points');
$img->setData (\@xanotherdataset, \@yanotherdataset,
               'Blue SolidLine NoPoints');

my ($xmin, $ymin, $xmax, $ymax) = $img->getBounds();

$img->setGraphOptions ('horGraphOffset' => 75,
                       'vertGraphOffset' => 100,
                       'title' => 'My Graph Title',
                       'horAxisLabel' => 'my X label',
                       'vertAxisLabel' => 'my Y label' );

print $img->draw();

$img->canvas($toplevel)->pack();

DESCRIPTION

This package overloads Chart::Plot and supplies a new method 'canvas' that returns a Tk Canvas equivalent to GD::Image returned by the method 'draw' of Chart::Plot.

The graphs are descripted by same way as for Chart::Plot.

With Chart::Plot::Canvas, the method 'draw' works like with Chart::Plot.

USAGE

See Chart::Plot for all over methods.

Create the canvas: canvas()

$img->canvas(toplevel);

This method creates the canvas and returns it.

use Chart::Plot::Canvas;

my $img = Chart::Plot->new();
$img->setData (\@xdataset, \@ydataset);
my $cv = $img->canvas($toplevel);
$cv->pack();

SEE ALSO

Chart::Plot

COPYRIGHT

(c) 2003-2011 Francois PERRAD, France. All rights reserved.

This library is distributed under the terms of the Artistic Licence 2.0.

AUTHOR

Francois PERRAD, francois.perrad@gadz.org