line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GIFgraph::WithMap; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
798
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
4
|
1
|
|
|
1
|
|
6
|
use vars qw (@ISA %fields $AUTOLOAD $VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
89
|
|
5
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
105
|
|
6
|
1
|
|
|
1
|
|
2093
|
use CGI; |
|
1
|
|
|
|
|
19421
|
|
|
1
|
|
|
|
|
9
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1816
|
use MRP::BaseClass; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = 1.0; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# use AUTOLOAD to pass everything that we can't do to _GIFgraph. |
13
|
|
|
|
|
|
|
# don't know if this is kosha. AHHHH. |
14
|
|
|
|
|
|
|
sub AUTOLOAD { |
15
|
|
|
|
|
|
|
my $thing = shift; |
16
|
|
|
|
|
|
|
my ($package, $function) = $AUTOLOAD =~ m/^(.*)::([^:]+)$/; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
if(ref($thing)) { |
19
|
|
|
|
|
|
|
my $delegate = $thing->_GIFgraph; |
20
|
|
|
|
|
|
|
$function = join '::', $delegate, $function; |
21
|
|
|
|
|
|
|
return $thing->$function(@_); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
die "Could not find method $AUTOLOAD via $thing"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub isa { |
27
|
|
|
|
|
|
|
my ($thing, $type) = @_; |
28
|
|
|
|
|
|
|
return $thing->_GIFgraph->isa($type) || $thing->SUPER::isa($type); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new { |
32
|
|
|
|
|
|
|
my $class = shift; |
33
|
|
|
|
|
|
|
my $GIFgraph = shift; |
34
|
|
|
|
|
|
|
my $baseClass = new MRP::BaseClass; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $self = $class->rebless($GIFgraph, $baseClass); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$self->_GIFgraph(ref $GIFgraph); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub draw_data { |
44
|
|
|
|
|
|
|
my ($self, $gd, $data) = @_; |
45
|
|
|
|
|
|
|
my $fuzz = $self->fuzz; |
46
|
|
|
|
|
|
|
my $map = ""; |
47
|
|
|
|
|
|
|
my $mapname = $self->mapname || confess "You must set the name for this map before calling plot"; |
48
|
|
|
|
|
|
|
my $seriesnames = $self->seriesnames; |
49
|
|
|
|
|
|
|
my $links = $self->links; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $delegateFunc = join '::', $self->_GIFgraph, 'draw_data'; |
52
|
|
|
|
|
|
|
$self->$delegateFunc($gd, $data); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$map = ' |
55
|
|
|
|
|
|
|
foreach my $series (1 .. $self->{numsets}) { |
56
|
|
|
|
|
|
|
my (@up, @down); |
57
|
|
|
|
|
|
|
foreach my $point (0 .. $self->{numpoints}) { |
58
|
|
|
|
|
|
|
next unless defined($$data[$series][$point]); |
59
|
|
|
|
|
|
|
my ($x, $y) = $self->val_to_pixel($point+1, $$data[$series][$point], $series); |
60
|
|
|
|
|
|
|
push @up, $x, $y+$fuzz; |
61
|
|
|
|
|
|
|
unshift @down, $x, $y-$fuzz; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
my $seriesname = $seriesnames->[$series-1] || 'series '.$series; |
64
|
|
|
|
|
|
|
my $link = $links->[$series-1] || "#$seriesname"; |
65
|
|
|
|
|
|
|
$map .= join("\n\t", |
66
|
|
|
|
|
|
|
'
|
67
|
|
|
|
|
|
|
'alt="' . $seriesname . '"', |
68
|
|
|
|
|
|
|
'href="' . $link . '"', |
69
|
|
|
|
|
|
|
'onMouseOver="self.status=' . "'$seriesname'" . '; return true"', |
70
|
|
|
|
|
|
|
'onMouseOut="self.status=' . "''" . '; return true"', |
71
|
|
|
|
|
|
|
'shape=polygon', |
72
|
|
|
|
|
|
|
'coords="' . join(', ', @up, @down) . '"', |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
$map .= ">\n"; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
$map .= "\n"; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$self->map($map); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
BEGIN { |
82
|
|
|
|
|
|
|
@ISA = qw (MRP::BaseClass); |
83
|
|
|
|
|
|
|
%fields = ( |
84
|
|
|
|
|
|
|
'fuzz' => 1, |
85
|
|
|
|
|
|
|
'map' => undef, |
86
|
|
|
|
|
|
|
'mapname' => undef, |
87
|
|
|
|
|
|
|
'seriesnames' => [], |
88
|
|
|
|
|
|
|
'links' => [], |
89
|
|
|
|
|
|
|
'_GIFgraph' => undef, |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
GIFgraph::WithMap->check4Clashes; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
$VERSION; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |