| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package Chart::HorizontalBars; |
|
21
|
|
|
|
|
|
|
|
|
22
|
4
|
|
|
4
|
|
139
|
use Chart::Base 2.3; |
|
|
4
|
|
|
|
|
105
|
|
|
|
4
|
|
|
|
|
76
|
|
|
23
|
4
|
|
|
4
|
|
98
|
use GD; |
|
|
4
|
|
|
|
|
38
|
|
|
|
4
|
|
|
|
|
83
|
|
|
24
|
4
|
|
|
4
|
|
71
|
use Carp; |
|
|
4
|
|
|
|
|
38
|
|
|
|
4
|
|
|
|
|
66
|
|
|
25
|
4
|
|
|
4
|
|
60
|
use strict; |
|
|
4
|
|
|
|
|
37
|
|
|
|
4
|
|
|
|
|
60
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
@Chart::HorizontalBars::ISA = qw(Chart::Base); |
|
28
|
|
|
|
|
|
|
$Chart::HorizontalBars::VERSION = '2.3'; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _draw_x_ticks { |
|
41
|
4
|
|
|
4
|
|
39
|
my $self = shift; |
|
42
|
4
|
|
|
|
|
43
|
my $data = $self->{'dataref'}; |
|
43
|
4
|
|
|
|
|
44
|
my $font = $self->{'tick_label_font'}; |
|
44
|
4
|
|
|
|
|
50
|
my $textcolor = $self->_color_role_to_index('text'); |
|
45
|
4
|
|
|
|
|
52
|
my $misccolor = $self->_color_role_to_index('misc'); |
|
46
|
4
|
|
|
|
|
43
|
my ($h, $w, $x1, $y1, ,$y2, $x2, $delta, $width, $label); |
|
47
|
4
|
|
|
|
|
37
|
my @labels = @{$self->{'y_tick_labels'}}; |
|
|
4
|
|
|
|
|
122
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
4
|
|
|
|
|
86
|
$self->{'grid_data'}->{'x'} = []; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
4
|
50
|
|
|
|
53
|
unless ((ref $font) eq 'GD::Font') { |
|
53
|
0
|
|
|
|
|
0
|
croak "The tick label font you specified isn't a GD font object"; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
4
|
|
|
|
|
66
|
($h, $w) = ($font->height, $font->width); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
|
60
|
4
|
100
|
|
|
|
139
|
if ( $self->{'y_axes'} =~ /^right$/i ){ |
|
|
|
100
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
10
|
$x1 = $self->{'curr_x_min'}; |
|
62
|
1
|
|
|
|
|
13
|
$width = $self->{'curr_x_max'} - $x1 -$self->{'tick_len'} - $self->{'text_space'} |
|
63
|
|
|
|
|
|
|
- $w * $self->{'x_tick_label_length'}; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
elsif ( $self->{'y_axes'} =~ /^both$/i) { |
|
66
|
2
|
|
|
|
|
68
|
$x1 = $self->{'curr_x_min'} + $self->{'text_space'} + $w* $self->{'x_tick_label_length'} |
|
67
|
|
|
|
|
|
|
+ $self->{'tick_len'}; |
|
68
|
2
|
|
|
|
|
25
|
$width = $self->{'curr_x_max'} - $x1 - $self->{'tick_len'} - $self->{'text_space'} |
|
69
|
|
|
|
|
|
|
- $w * $self->{'x_tick_label_length'}; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
else { |
|
72
|
1
|
|
|
|
|
12
|
$x1 = $self->{'curr_x_min'} + $self->{'text_space'} + $w* $self->{'x_tick_label_length'} |
|
73
|
|
|
|
|
|
|
+ $self->{'tick_len'}; |
|
74
|
1
|
|
|
|
|
10
|
$width = $self->{'curr_x_max'} - $x1; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
|
78
|
4
|
|
|
|
|
41
|
$delta = $width / ($self->{'y_ticks'} -1) ; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
4
|
|
|
|
|
37
|
$y2 =$y1; |
|
82
|
|
|
|
|
|
|
|
|
83
|
4
|
100
|
|
|
|
59
|
if ($self->{'x_ticks'} =~ /^normal/i ) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
2
|
|
|
|
|
47
|
$y1 = $self->{'curr_y_max'} - 2*$self->{'text_space'} -$h - $self->{'tick_len'}; |
|
86
|
|
|
|
|
|
|
|
|
87
|
2
|
|
|
|
|
21
|
$y2 = $y1 + $self->{'tick_len'} + $self->{'text_space'}; |
|
88
|
2
|
|
|
|
|
26
|
for (0..$#labels){ |
|
89
|
27
|
|
|
|
|
244
|
$label = $self->{'y_tick_labels'}[$_]; |
|
90
|
27
|
|
|
|
|
250
|
$x2 = $x1 + ($delta * $_) - ($w* length( $label)/2) ; |
|
91
|
27
|
|
|
|
|
380
|
$self->{'gd_obj'}->string($font, $x2, $y2 , $label , $textcolor); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
elsif ($self->{'x_ticks'} =~ /^staggered/i ) { |
|
95
|
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
11
|
$y1 = $self->{'curr_y_max'} - 3*$self->{'text_space'} - 2*$h - $self->{'tick_len'}; |
|
97
|
|
|
|
|
|
|
|
|
98
|
1
|
|
|
|
|
13
|
for (0..$#labels) { |
|
99
|
6
|
|
|
|
|
58
|
$label = $self->{'y_tick_labels'}[$_]; |
|
100
|
6
|
|
|
|
|
167
|
$x2 = $x1 + ($delta * $_) - ($w* length( $label)/2); |
|
101
|
6
|
100
|
|
|
|
58
|
unless ($_%2) { |
|
102
|
3
|
|
|
|
|
33
|
$y2 = $y1 + $self->{'text_space'} + $self->{'tick_len'}; |
|
103
|
3
|
|
|
|
|
49
|
$self->{'gd_obj'}->string($font, $x2, $y2 , $label, $textcolor); |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
else { |
|
106
|
3
|
|
|
|
|
32
|
$y2 = $y1 + $h + 2*$self->{'text_space'} + $self->{'tick_len'}; |
|
107
|
3
|
|
|
|
|
68
|
$self->{'gd_obj'}->string($font, $x2, $y2 , $label, $textcolor); |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
elsif ($self->{'x_ticks'} =~ /^vertical/i ) { |
|
114
|
|
|
|
|
|
|
|
|
115
|
1
|
|
|
|
|
11
|
$y1 = $self->{'curr_y_max'} - 2*$self->{'text_space'} -$w* $self->{'y_tick_label_length'} - $self->{'tick_len'}; |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
|
118
|
1
|
|
|
|
|
15
|
for (0..$#labels){ |
|
119
|
11
|
|
|
|
|
113
|
$label = $self->{'y_tick_labels'}[$_]; |
|
120
|
|
|
|
|
|
|
|
|
121
|
11
|
|
|
|
|
105
|
$y2 = $y1 + $self->{'tick_len'} + $w* length($label) + $self->{'text_space'}; |
|
122
|
|
|
|
|
|
|
|
|
123
|
11
|
|
|
|
|
128
|
$x2 = $x1 + ($delta * $_) - ($h /2); |
|
124
|
11
|
|
|
|
|
329
|
$self->{'gd_obj'}->stringUp($font, $x2, $y2 , $label , $textcolor); |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
else { |
|
130
|
0
|
|
|
|
|
0
|
carp "I don't understand the type of x-ticks you specified"; |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
4
|
|
|
|
|
45
|
$self->{'curr_y_max'} = $y1; |
|
134
|
4
|
|
|
|
|
41
|
$self->{'curr_x_max'} = $x1 + $width; |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
|
137
|
4
|
|
|
|
|
67
|
$y1 =$self->{'curr_y_max'}; |
|
138
|
4
|
|
|
|
|
42
|
$y2 =$self->{'curr_y_max'} + $self->{'tick_len'}; |
|
139
|
4
|
|
|
|
|
46
|
for(0..$#labels ) { |
|
140
|
44
|
|
|
|
|
379
|
$x2 = $x1 + ($delta * $_); |
|
141
|
44
|
|
|
|
|
692
|
$self->{'gd_obj'}->line($x2, $y1, $x2, $y2, $misccolor); |
|
142
|
44
|
50
|
66
|
|
|
557
|
if (($self->{'grid_lines'} =~ /^true$/i) or ($self->{'x_grid_lines'} =~ /^true$/i)) { |
|
143
|
44
|
|
|
|
|
858
|
$self->{'grid_data'}->{'x'}->[$_] = $x2; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
4
|
|
|
|
|
92
|
return 1; |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub _draw_y_ticks { |
|
153
|
4
|
|
|
4
|
|
41
|
my $self = shift; |
|
154
|
4
|
|
50
|
|
|
53
|
my $side = shift || 'left'; |
|
155
|
4
|
|
|
|
|
88
|
my $data = $self->{'dataref'}; |
|
156
|
4
|
|
|
|
|
44
|
my $font = $self->{'tick_label_font'}; |
|
157
|
4
|
|
|
|
|
53
|
my $textcolor = $self->_color_role_to_index ('text'); |
|
158
|
4
|
|
|
|
|
49
|
my $misccolor = $self->_color_role_to_index ('misc'); |
|
159
|
4
|
|
|
|
|
47
|
my ($h, $w, $x1, $x2, $y1, $y2); |
|
160
|
4
|
|
|
|
|
39
|
my ($width, $height, $delta); |
|
161
|
|
|
|
|
|
|
|
|
162
|
4
|
|
|
|
|
53
|
$self->{'grid_data'}->{'y'} =[]; |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
|
165
|
4
|
50
|
|
|
|
57
|
unless ((ref $font) eq 'GD::Font') { |
|
166
|
0
|
|
|
|
|
0
|
croak "The tick label font isn't a GD Font object!"; |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
|
170
|
4
|
|
|
|
|
144
|
($h, $w) = ($font->height, $font->width); |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
|
|
173
|
4
|
100
|
|
|
|
64
|
if ($side =~ /^right$/i) { |
|
|
|
100
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
|
|
175
|
1
|
|
|
|
|
11
|
$x1 = $self->{'curr_x_max'}; |
|
176
|
1
|
|
|
|
|
12
|
$y1 = $self->{'curr_y_max'} - $h/2; |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
|
179
|
1
|
|
|
|
|
11
|
$height = $self->{'curr_y_max'} - $self->{'curr_y_min'} ; |
|
180
|
1
|
50
|
|
|
|
14
|
$delta = ($height) / ($self->{'num_datapoints'} > 0 ? $self->{'num_datapoints'} : 1); |
|
181
|
1
|
|
|
|
|
10
|
$y1 -= ($delta/2 ); |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
|
|
184
|
1
|
50
|
|
|
|
13
|
if (!defined($self->{'skip_y_ticks'})) { |
|
185
|
0
|
|
|
|
|
0
|
$self->{'skip_y_ticks'} =1; |
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
|
189
|
1
|
|
|
|
|
13
|
for(0.. int (($self->{'num_datapoints'} - 1) / $self->{'skip_y_ticks'})) { |
|
190
|
5
|
|
|
|
|
48
|
$y2 = $y1 - ($delta) * ($_ * $self->{'skip_y_ticks'}); |
|
191
|
5
|
|
|
|
|
45
|
$x2 = $x1 + $self->{'tick_len'} + $self->{'text_space'}; |
|
192
|
5
|
|
|
|
|
64
|
$self->{'gd_obj'}->string($font, $x2, $y2, |
|
193
|
|
|
|
|
|
|
$self->{f_y_tick}->($data->[0][$_*$self->{'skip_y_ticks'}]), $textcolor); |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
|
197
|
1
|
|
|
|
|
10
|
$x1 = $self->{'curr_x_max'}; |
|
198
|
1
|
|
|
|
|
10
|
$x2 = $self->{'curr_x_max'} + $self->{'tick_len'}; |
|
199
|
1
|
|
|
|
|
10
|
$y1 += $h/2; |
|
200
|
1
|
|
|
|
|
12
|
for(0..($self->{'num_datapoints'} -1 / $self->{'skip_y_ticks'})) { |
|
201
|
5
|
|
|
|
|
42
|
$y2 = $y1 - ($delta * $_); |
|
202
|
5
|
|
|
|
|
64
|
$self->{'gd_obj'}->line($x1,$y2,$x2,$y2,$misccolor); |
|
203
|
5
|
50
|
33
|
|
|
75
|
if ($self->{'grid_lines'} =~ /^true$/i or $self->{'x_grid_lines'} =~ /^true$/i ) { |
|
204
|
5
|
|
|
|
|
53
|
$self->{'grid_data'}->{'y'}->[$_] = $y2; |
|
205
|
|
|
|
|
|
|
} |
|
206
|
|
|
|
|
|
|
} |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
elsif ($side =~ /^both$/i) { |
|
210
|
|
|
|
|
|
|
|
|
211
|
2
|
|
|
|
|
22
|
$x1 = $self->{'curr_x_max'}; |
|
212
|
2
|
|
|
|
|
70
|
$y1 = $self->{'curr_y_max'} - $h/2; |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
|
|
215
|
2
|
|
|
|
|
22
|
$height = $self->{'curr_y_max'} - $self->{'curr_y_min'} ; |
|
216
|
2
|
50
|
|
|
|
26
|
$delta = ($height) / ($self->{'num_datapoints'} > 0 ? $self->{'num_datapoints'} : 1); |
|
217
|
2
|
|
|
|
|
20
|
$y1 -= ($delta/2 ); |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
|
|
220
|
2
|
50
|
|
|
|
24
|
if (!defined($self->{'skip_y_ticks'})) { |
|
221
|
0
|
|
|
|
|
0
|
$self->{'skip_y_ticks'} =1; |
|
222
|
|
|
|
|
|
|
} |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
|
|
225
|
2
|
|
|
|
|
28
|
for(0.. int (($self->{'num_datapoints'} - 1) / $self->{'skip_y_ticks'})) { |
|
226
|
17
|
|
|
|
|
157
|
$y2 = $y1 - ($delta) * ($_ * $self->{'skip_y_ticks'}); |
|
227
|
17
|
|
|
|
|
154
|
$x2 = $x1 + $self->{'tick_len'} + $self->{'text_space'}; |
|
228
|
17
|
|
|
|
|
206
|
$self->{'gd_obj'}->string($font, $x2, $y2, |
|
229
|
|
|
|
|
|
|
$self->{f_y_tick}->($data->[0][$_*$self->{'skip_y_ticks'}]), $textcolor); |
|
230
|
|
|
|
|
|
|
} |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
|
|
233
|
2
|
|
|
|
|
21
|
$x1 = $self->{'curr_x_max'}; |
|
234
|
2
|
|
|
|
|
21
|
$x2 = $self->{'curr_x_max'} + $self->{'tick_len'}; |
|
235
|
2
|
|
|
|
|
327
|
$y1 += $h/2; |
|
236
|
2
|
|
|
|
|
27
|
for(0..($self->{'num_datapoints'} -1 / $self->{'skip_y_ticks'})) { |
|
237
|
17
|
|
|
|
|
147
|
$y2 = $y1 - ($delta * $_); |
|
238
|
17
|
|
|
|
|
228
|
$self->{'gd_obj'}->line($x1,$y2,$x2,$y2,$misccolor); |
|
239
|
17
|
50
|
33
|
|
|
595
|
if ($self->{'grid_lines'} =~ /^true$/i or $self->{'x_grid_lines'} =~ /^true$/i ) { |
|
240
|
17
|
|
|
|
|
191
|
$self->{'grid_data'}->{'y'}->[$_] = $y2; |
|
241
|
|
|
|
|
|
|
} |
|
242
|
|
|
|
|
|
|
} |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
|
|
245
|
2
|
|
|
|
|
26
|
$x1 = $self->{'curr_x_min'} ; |
|
246
|
2
|
|
|
|
|
67
|
$y1 = $self->{'curr_y_max'} -$h/2 ; |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
|
|
249
|
2
|
|
|
|
|
22
|
$height = $self->{'curr_y_max'} - $self->{'curr_y_min'} ; |
|
250
|
2
|
50
|
|
|
|
28
|
$delta = ($height) / ($self->{'num_datapoints'} > 0 ? $self->{'num_datapoints'} : 1); |
|
251
|
2
|
|
|
|
|
21
|
$y1 -= ($delta/2 ); |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
|
|
254
|
2
|
|
|
|
|
29
|
for(0.. int (($self->{'num_datapoints'} - 1) / $self->{'skip_y_ticks'})) { |
|
255
|
17
|
|
|
|
|
156
|
$y2 = $y1 - ($delta) * ($_ * $self->{'skip_y_ticks'}); |
|
256
|
17
|
|
|
|
|
202
|
$x2 = $x1 - $w * length($self->{f_y_tick}->($data->[0][$_*$self->{'skip_y_ticks'}])) |
|
257
|
|
|
|
|
|
|
+ $w * $self->{'x_tick_label_length'}; |
|
258
|
17
|
|
|
|
|
224
|
$self->{'gd_obj'}->string($font, $x2, $y2, |
|
259
|
|
|
|
|
|
|
$self->{f_y_tick}->($data->[0][$_*$self->{'skip_y_ticks'}]), $textcolor); |
|
260
|
|
|
|
|
|
|
} |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
|
|
263
|
2
|
|
|
|
|
28
|
$self->{'curr_x_min'} = $x1 + $self->{'text_space'} + $w* $self->{'x_tick_label_length'} |
|
264
|
|
|
|
|
|
|
+ $self->{'tick_len'}; |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
|
267
|
2
|
|
|
|
|
288
|
$x1 = $self->{'curr_x_min'}; |
|
268
|
2
|
|
|
|
|
21
|
$x2 = $self->{'curr_x_min'} - $self->{'tick_len'}; |
|
269
|
2
|
|
|
|
|
21
|
$y1 += $h/2; |
|
270
|
2
|
|
|
|
|
25
|
for(0..($self->{'num_datapoints'} -1 / $self |