| 1 | package CGI::Graph::Plot::points::numerical; | ||
| 2 | |||
| 3 | 0 | ▶ | use CGI::Graph::Plot::points; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 4 | |||
| 5 | @ISA = ("CGI::Graph::Plot::points"); | ||
| 6 | |||
| 7 | # | ||
| 8 | # makes call to parent class where all real work is done | ||
| 9 | # | ||
| 10 | |||
| 11 | sub new { | ||
| 12 | my ($pkg, $vars) = @_; | ||
| 13 | my $class = ref($pkg) || $pkg; | ||
| 14 | my $self = $class->SUPER::new($vars); | ||
| 15 | return bless $self, $class; | ||
| 16 | } | ||
| 17 | |||
| 18 | # | ||
| 19 | # returns what is passed in since all points are already numerical | ||
| 20 | # | ||
| 21 | |||
| 22 | sub count { | ||
| 23 | my $self = shift; | ||
| 24 | return @_; | ||
| 25 | } | ||
| 26 | |||
| 27 | # | ||
| 28 | # returns a reference to X, Y, and select arrays that will be used to create | ||
| 29 | # graph images. | ||
| 30 | # | ||
| 31 | |||
| 32 | sub valuesInRange{ | ||
| 33 | my $self = shift; | ||
| 34 | |||
| 35 | my @selected = split("",$self->{selected}); | ||
| 36 | |||
| 37 | my @row = $self->{table}->col('_row'); | ||
| 38 | my @X = ($self->{table})->col($self->{X}); | ||
| 39 | my @Y = ($self->{table})->col($self->{Y}); | ||
| 40 | |||
| 41 | my @returnY; | ||
| 42 | my $yFlag; | ||
| 43 | |||
| 44 | # determine if elements are selected and/or in range | ||
| 45 | for (0..$#X) { | ||
| 46 | push (@selectDraw, $selected[$row[$_]-1]); | ||
| 47 | # determines if element is in range | ||
| 48 | if ($X[$_] >= $self->{x_min} && $X[$_] <= $self->{x_max} && | ||
| 49 | $Y[$_] >= $self->{y_min} && $Y[$_] <= $self->{y_max}) { | ||
| 50 | push (@returnY,$Y[$_]); | ||
| 51 | $yFlag++; | ||
| 52 | } | ||
| 53 | # if element not in range, use undef | ||
| 54 | else { | ||
| 55 | push (@returnY,undef); | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | # make sure that returnY has at least one non-undef value | ||
| 60 | unless ($yFlag) { | ||
| 61 | $returnY[0]=$self->{y_min}-$self->{y_max}; | ||
| 62 | } | ||
| 63 | |||
| 64 | return (\@X,\@returnY,\@selectDraw); | ||
| 65 | } | ||
| 66 | |||
| 67 | 1; | ||