line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Chart::Plot::Tagged; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
18892
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
324
|
use GD; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use base qw(Chart::Plot); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub setTag { |
13
|
|
|
|
|
|
|
my $self = shift; |
14
|
|
|
|
|
|
|
my ($arrayref) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# record the dataset |
17
|
|
|
|
|
|
|
my $label = $self->{_numDataSets}; |
18
|
|
|
|
|
|
|
$self->{_tag}->{$label} = $arrayref; |
19
|
|
|
|
|
|
|
return $label; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _drawData { |
23
|
|
|
|
|
|
|
my $self = shift; |
24
|
|
|
|
|
|
|
$self->SUPER::_drawData(); |
25
|
|
|
|
|
|
|
$self->_drawTag(); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _drawTag { |
29
|
|
|
|
|
|
|
my $self = shift; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
foreach my $dataSetLabel (keys %{$self->{_data}}) { |
32
|
|
|
|
|
|
|
next unless (exists $self->{_tag}->{$dataSetLabel}); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# get color |
35
|
|
|
|
|
|
|
my $color = '_black'; |
36
|
|
|
|
|
|
|
if ( $self->{'_dataStyle'}->{$dataSetLabel} =~ /((red)|(blue)|(green))/i ) { |
37
|
|
|
|
|
|
|
$color = "_$1"; |
38
|
|
|
|
|
|
|
$color =~ tr/A-Z/a-z/; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# get direction |
42
|
|
|
|
|
|
|
my $dir = ''; |
43
|
|
|
|
|
|
|
$dir = 'up' if $self->{'_dataStyle'}->{$dataSetLabel} =~ /up/i; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $num = @{ $self->{'_data'}->{$dataSetLabel} }; |
46
|
|
|
|
|
|
|
my $prevpx = 0; |
47
|
|
|
|
|
|
|
for (my $i = 0; $i < $num/2; $i ++) { |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# get next point |
50
|
|
|
|
|
|
|
my ($px, $py) = $self->_data2pxl ( |
51
|
|
|
|
|
|
|
$self->{_data}->{$dataSetLabel}[2*$i], |
52
|
|
|
|
|
|
|
$self->{_data}->{$dataSetLabel}[2*$i+1] |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $lbl = $self->{_tag}->{$dataSetLabel}[$i] || ''; |
56
|
|
|
|
|
|
|
if ($lbl ne '' && $px != $prevpx) { |
57
|
|
|
|
|
|
|
if ($dir eq 'up') { |
58
|
|
|
|
|
|
|
$self->{'_im'}->stringUp(gdTinyFont, $px-8, $py-5, |
59
|
|
|
|
|
|
|
$lbl, $self->{$color}); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else { |
62
|
|
|
|
|
|
|
$self->{'_im'}->string(gdTinyFont, $px+5, $py-4, |
63
|
|
|
|
|
|
|
$lbl, $self->{$color}); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
$prevpx = $px; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
__END__ |