NAME
Wx::SimplePlotter - Simple Plotter Control
SYNOPSIS
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.
DESCRIPTION
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.
METHODS
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. 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. OnPaint
-
Paint handler that draws the points.
OnSize
-
Resizing handler that re-scales the points.
SEE ALSO
WxWidgets http://wxwidgets.org/
AUTHOR
Christian Renz, <crenz @ web42.com<gt>
COPYRIGHT AND LICENSE
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.