Wx::SimplePlotter - Simple Plotter Control
use Wx::SimplePlotter; # init app, window etc. my $plotter = Wx::SimplePlotter->new(); $plotter->SetColours([0, 0, 0], [255, 0, 0], [0, 0, 255], [0, 255, 0]); $plotter->SetPoints(...) # plot ten sinus functions on a logarithmic x scale my (@a); for (1..1000) { for my $i (0..9) { push @{$a[$i]}, [log($_), sin($_ / 10) * $i]; } } $plotter->SetPoints(@a); # add plotter control to sizer, start app etc.
This wxWidgets control plots points (e.g. function results) with different colors. It automatically scales its output according to the control size.
The points are passed as pairs of coordinates. Points are connected by lines when drawn.
The control has been tested on Mac OS X, but should work on other operating systems (including Windows and Linux) as well.
new
Passes its arguments to the constructor of wxControl.
SetPoints($ary1, $ary2, ...)
Sets the point data. The array referenced by each parameter contains pairs of coordinates (x, y).
SetColours($col1, $col2, $col3)
Sets the colours used to draw the data arrays. Each colours is a reference to an array that contains three colour values (red, green and blue). The default colours are [[0, 0, 0], [255, 0, 0], [0, 0, 255], [0, 255, 0]]. Colours are cycled if you use more data sets than colours.
[[0, 0, 0], [255, 0, 0], [0, 0, 255], [0, 255, 0]]
ScalePoints()
Scales the point data according to the control size. Is called automatically whenever the control is resized and when SetPoints is called, so there should be no need for you to call it directly.
SetPoints
OnPaint
Paint handler that draws the points.
OnSize
Resizing handler that re-scales the points.
Wx
WxWidgets http://wxwidgets.org/
Christian Renz, <crenz @ web42.com<gt>
Copyright 2004-2005 by Christian Renz >crenz @ web42.com<
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Wx::SimplePlotter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Wx::SimplePlotter
CPAN shell
perl -MCPAN -e shell install Wx::SimplePlotter
For more information on module installation, please visit the detailed CPAN module installation guide.