Graph/Frame.pm

filter: Statementstmt 69.3% 138 / 199 Branchbran 51.0% 48 / 94 Conditioncond 34.7% 8 / 23 MC/DCmcdc 0.0% 0 / 14 Subroutinesub 91.6% 33 / 36 Podpod 76.6% 23 / 30 totaltotal 63.1% 250 / 396 CC 68 SCAR 25.3
CC
68
Cov
61%
add_frame
56.0
_recalculate_stats
28.6
add_data
16.0
CRAP 12.5
« Graph/Glyph/bar.pm ↑ Summary Graph/File.pm »
1 package SVG::Graph::Frame;
2  
3 7 ▶use base SVG::Graph::Data;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head2 new
8  
9 Title : new
10 Usage : you should not be calling new, see add_frame
11 Function:
12 Example :
13 Returns :
14 Args :
15  
16  
17 =cut
18  
19 10 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
20 10 my($class, %args) = @_;
21 10 my $self = bless {}, $class;
22 10 $self->init(%args);
23 10 return $self;
24 }
25  
26 =head2 init
27  
28 Title : init
29 Usage :
30 Function:
31 Example :
32 Returns :
33 Args :
34  
35  
36 =cut
37  
38 10 ▶sub init {
Subroutine init: called CC=6 SCAR=26.7
Pod documented
39 10 my($self, %args) = @_;
40  
41 # die "you must provide a 'data' arg to new()" unless $args{data};
42 10 $self->_parent_svg($args{svg});
43  
44 10 foreach my $arg (keys %args){
45 60 my $meth = 'add_'.$arg;
46 60 $self->$meth($args{$arg});
47 }
48  
49 10 my $id = 'n'.sprintf("%07d",int(rand(9999999)));
50 10 my $group;
51  
52 10 ▶ if($self->frame_transform eq "top") {
Branch: 4 branches
BranchTrueFalseTotal
if ($self->frame_transform eq 'top') { } 0 10 10
elsif ($self->frame_transform eq 'left') { } 0 10 10
elsif ($self->frame_transform eq 'right') { } 0 10 10
elsif ($self->frame_transform eq 'bottom') { } 0 10 10
53 0 $group=$self->_parent_svg->svg->group(id=> $id);
54 }
55 elsif($self->frame_transform eq "left") {
56  
57 0 my $scaley = $self->xsize/$self->ysize;
58 0 my $scalex = $self->ysize/$self->xsize;
59
60 0 my $translateoffx = -$self->xoffset;
61 0 my $translateoffy = -$self->yoffset;
62  
63 0 my $translatey = $self->ysize + $self->yoffset;
64 0 my $translatex = $self->xoffset;
65
66 0 $group = $self->_parent_svg->svg->group(id => $id, transform =>"translate($translatex, $translatey) scale($scaley, $scalex) rotate(-90) translate($translateoffx, $translateoffy)");
67 }
68 elsif($self->frame_transform eq "right") {
69
70 0 my $scalex = $self->xsize/$self->ysize;
71 0 my $scaley = $self->ysize/$self->xsize;
72  
73 0 my $translateoffx = -$self->xoffset;
74 0 my $translateoffy = -$self->yoffset;
75  
76 0 my $translatey = $self->yoffset;
77 0 my $translatex = $self->xsize + $self->xoffset;
78  
79 0 $group=$self->_parent_svg->svg->group(id => $id, transform => "translate($translatex, $translatey) scale($scalex, $scaley) rotate(90) translate($translateoffx, $translateoffy)");
80  
81 }
82 elsif($self->frame_transform eq "bottom") {
83  
84 0 my $translateoffx = -$self->xoffset;
85 0 my $translateoffy = -$self->yoffset;
86  
87 0 my $translatex = $self->xsize + $self->xoffset;
88 0 my $translatey = $self->ysize + $self->yoffset;
89 0 $group=$self->_parent_svg->svg->group(id => $id, transform => "translate($translatex, $translatey) rotate(180) translate($translateoffx, $translateoffy)");
90  
91 }
92 else {
93 10 $group=$self->_parent_svg->svg->group(id=> $id);
94 }
95
96 10 $self->svg($group);
97 10 $self->is_changed(1);
98 }
99  
100 =head2 add_glyph
101  
102 Title : add_glyph
103 Usage : $frame->add_glyph( 'glyph_name', glyph_args=>arg)
104 Function: adds a glyph to the Frame object
105 Returns : a SVG::Graph::Glyph::glyph_name object
106 Args : glyph dependent
107  
108  
109 =cut
110  
111 14 ▶sub add_glyph {
Subroutine add_glyph: called CC=3 SCAR=11.3
Pod documented
112 14 my($self, $glyphtype, %args) = @_;
113  
114 14 ▶ my $class = 'SVG::Graph::Glyph::'.$glyphtype || 'generic';
Condition50%1/2
'SVG::Graph::Glyph::' . $glyphtype || 'generic'
l!l
140
MC/DC0%0/1
'SVG::Graph::Glyph::' . $glyphtype || 'generic'
'SVG::Graph::Glyph::' . $glyphtype
Truth table50%1/2
A
A= 'SVG::Graph::Glyph::' . $glyphtype
Aresult
11
00
115 0 ▶ eval "require $class"; if($@){ die "couldn't load $class: $@" };
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 14 14
116  
117 14 my $glyph = $class->new(%args, svg => $self->svg, group => $self,
118 xsize=>$self->xsize,
119 ysize=>$self->ysize,
120 xoffset=>$self->xoffset,
121 yoffset=>$self->yoffset,
122 );
123 14 push @{$self->{glyphs}}, $glyph;
124 14 return $glyph;
125 }
126  
127 =head2 add_frame
128  
129 Title : add_frame
130 Usage : my $frame = $graph->add_frame
131 Function: adds a Frame to the current Frame
132 Returns : a SVG::Graph::Frame object
133 Args : (optional) frame_transform => 'top' default orientation
134 'bottom' rotates graph 180 deg (about the center)
135 'right' points top position towards right
136 'left' points top position towards left
137
138  
139  
140 =cut
141  
142 0 ▶sub add_frame {
Subroutine add_frame: not called CC=7 SCAR=40.3
Pod documented
143 0 my($self,$frames) = @_;
144  
145 0 my $epitaph = "only SVG::Graph::Frame objects accepted";
146  
147 #die $epitaph unless ref $frames->{frame} eq 'SVG::Graph::Frame';
148
149 0 my $frame_arg = $frames->{frame};
150  
151 0 ▶ if (ref($frame_arg) eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $frame_arg eq 'ARRAY') { } 0 0 0
elsif (ref $frame_arg eq __PACKAGE__) { } 0 0 0
152 0 foreach my $frame (@$frame_arg) {
153 0 ▶ die $epitaph unless ref $frame eq 'SVG::Graph::Frame';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $frame eq "SVG::Graph::Frame" 0 0 0
154 0 push @{$self->{frames}}, $frame;
155 }
156
157 }
158 elsif(ref($frame_arg) eq __PACKAGE__) {
159 0 push @{$self->{frames}}, $frame_arg;
160 }
161 else {
162 my $frame = SVG::Graph::Frame->new(svg=>$self->_parent_svg,
163 _parent_frame=>$self,
164 xoffset=>$self->_parent_svg->margin,
165 yoffset=>$self->_parent_svg->margin,
166 xsize=>$self->_parent_svg->width - (2 * $self->_parent_svg->margin),
167 ysize=>$self->_parent_svg->height - (2 * $self->_parent_svg->margin),
168 frame_transform=>$frames->{frame_transform}
169 0 );
170
171 0 ▶ $frame->stack($self->stack) if $self->stack;
Branch: 1 branch
BranchTrueFalseTotal
if $self->stack 0 0 0
172 0 ▶ $frame->ystat($self->ystat) if $self->stack;
Branch: 1 branch
BranchTrueFalseTotal
if $self->stack 0 0 0
173
174 0 push @{$self->{frames}}, $frame;
175 0 return $frame;
176 }
177  
178 0 $self->is_changed(1);
179 }
180  
181 =head2 frames
182  
183 Title : frames
184 Usage :
185 Function:
186 Example :
187 Returns :
188 Args :
189  
190  
191 =cut
192  
193 69 ▶sub frames {
Subroutine frames: called CC=2 SCAR=8.1
Pod documented
194 69 my $self = shift;
195 0 ▶ return $self->{frames} ? @{$self->{frames}} : ();
Branch: 1 branch
BranchTrueFalseTotal
$self->{'frames'} ? : 0 69 69
196 }
197  
198 =head2 add_data
199  
200 Title : add_data
201 Usage : $frame->add_data($data)
202 Function: adds a SVG::Graph::Data object to the current Frame
203 Returns : none
204 Args : SVG::Graph::Data object
205  
206  
207 =cut
208  
209 10 ▶sub add_data {
Subroutine add_data: called CC=8 SCAR=27.7
Pod documented
210 10 my($self,@datas) = @_;
211  
212 10 my $epitaph = "only SVG::Graph::Data objects accepted";
213  
214 10 foreach my $data (@datas){
215 10 ▶ if(ref $data eq 'ARRAY'){
Branch: 1 branch
BranchTrueFalseTotal
if (ref $data eq 'ARRAY') { } 0 10 10
216 0 foreach my $d (@$data){
217 0 ▶ die $epitaph unless ref $d eq 'SVG::Graph::Data' || ref $data eq 'SVG::Graph::Data::Tree';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $d eq "SVG::Graph::Data" or ref $data eq "SVG::Graph::Data::Tree" 0 0 0
Condition0%0/3
ref $d eq "SVG::Graph::Data" or ref $data eq "SVG::Graph::Data::Tree"
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $d eq "SVG::Graph::Data" or ref $data eq "SVG::Graph::Data::Tree"
ref $d eq "SVG::Graph::Data" ref $data eq "SVG::Graph::Data::Tree"
Truth table0%0/3
A or B
A= ref $d eq "SVG::Graph::Data"B= ref $data eq "SVG::Graph::Data::Tree"
ABresult
1X1
011
000
218 0 push @{$self->{data}}, $d;
219 }
220 } else {
221 10 ▶ die $epitaph unless ref $data eq 'SVG::Graph::Data' || ref $data eq 'SVG::Graph::Data::Tree';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $data eq "SVG::Graph::Data" or ref $data eq "SVG::Graph::Data::Tree" 0 10 10
Condition66%2/3
ref $data eq "SVG::Graph::Data" or ref $data eq "SVG::Graph::Data::Tree"
l!l&&r!l&&!r
910
MC/DC0%0/2
ref $data eq "SVG::Graph::Data" or ref $data eq "SVG::Graph::Data::Tree"
ref $data eq "SVG::Graph::Data" ref $data eq "SVG::Graph::Data::Tree"
Truth table66%2/3
A or B
A= ref $data eq "SVG::Graph::Data"B= ref $data eq "SVG::Graph::Data::Tree"
ABresult
1X1
011
000
222 10 push @{$self->{data}}, $data;
223 }
224 }
225  
226 10 $self->is_changed(1);
227 }
228  
229 =head2 all_data
230  
231 Title : all_data
232 Usage :
233 Function:
234 Example :
235 Returns :
236 Args :
237  
238  
239 =cut
240  
241 24 ▶sub all_data {
Subroutine all_data: called CC=7 SCAR=25.1
Pod documented
242 24 my $self = shift;
243 24 my $flag = shift;
244  
245 24 ▶ if(($self->_parent_frame && $flag) || !$self->_parent_frame){
Branch: 2 branches
BranchTrueFalseTotal
if ($self->_parent_frame and $flag or not $self->_parent_frame) { } 24 0 24
elsif ($self->_parent_frame) { } 0 0 0
Condition33%2/6
$self->_parent_frame and $flag or not $self->_parent_frame
l!l&&r!l&&!r
0240
$self->_parent_frame and $flag
!ll&&!rl&&r
2400
MC/DC0%0/3
$self->_parent_frame and $flag or not $self->_parent_frame
$self->_parent_frame $flag not $self->_parent_frame
Truth table20%1/5
A and B or not(C)
A= $self->_parent_frameB= $flagC= not $self->_parent_frame
ABCresult
11X1
0X11
1011
0X00
1000
246 24 my @data = $self->data;
247  
248 #recurse down into subframes...
249 24 foreach my $subframe ($self->frames){
250 0 push @data, $subframe->all_data(1);
251 }
252  
253 24 ▶ return map {$_->can('data') ? $_->all_data(1) : $_ } @data;
Branch: 1 branch
BranchTrueFalseTotal
$_->can('data') ? : 0 480 480
254 } elsif($self->_parent_frame) {
255 0 return $self->_parent_frame->all_data;
256 }
257 }
258  
259 =head2 data
260  
261 Title : data
262 Usage :
263 Function:
264 Example :
265 Returns :
266 Args :
267  
268  
269 =cut
270  
271 35 ▶sub data {
Subroutine data: called CC=4 SCAR=14.1
Pod documented
272 35 my $self = shift;
273  
274 #these are SVG::Graph::Data objects
275 35 ▶ my @data = $self->{data} ? @{$self->{data}} : ();
Branch: 1 branch
BranchTrueFalseTotal
$self->{'data'} ? : 35 0 35
276  
277 #recurse down into subframes...
278 35 foreach my $subframe ($self->frames){
279 0 push @data, $subframe->data;
280 }
281  
282 35 ▶ return map {$_->can('data') ? $_->data : $_ } @data;
Branch: 1 branch
BranchTrueFalseTotal
$_->can('data') ? : 34 1 35
283 }
284  
285 =head2 glyphs
286  
287 Title : glyphs
288 Usage :
289 Function:
290 Example :
291 Returns :
292 Args :
293  
294  
295 =cut
296  
297 10 ▶sub glyphs {
Subroutine glyphs: called CC=2 SCAR=7.1
Pod documented
298 10 my $self = shift;
299 10 ▶ return $self->{glyphs} ? @{$self->{glyphs}} : ();
Branch: 1 branch
BranchTrueFalseTotal
$self->{'glyphs'} ? : 10 0 10
300 }
301  
302 =head2 data_chunks
303  
304 Title : data_chunks
305 Usage :
306 Function:
307 Example :
308 Returns :
309 Args :
310  
311  
312 =cut
313  
314 0 ▶sub data_chunks {
Subroutine data_chunks: not called CC=3 SCAR=24.8
Pod documented
315 0 my $self = shift;
316  
317 0 ▶ my @data = $self->{data} ? @{$self->{data}} : ();
Branch: 1 branch
BranchTrueFalseTotal
$self->{'data'} ? : 0 0 0
318  
319 #recurse down into subframes...
320 0 foreach my $subframe ($self->frames){
321 0 push @data, $subframe->data_chunks;
322 }
323  
324 0 return @data;
325 }
326  
327 =head2 draw
328  
329 Title : draw
330 Usage : should not directly call this method, see SVG::Graph->draw
331 Function: depends on child glyph implementations
332 Example :
333 Returns :
334 Args :
335  
336  
337 =cut
338  
339 10 ▶sub draw {
Subroutine draw: called CC=3 SCAR=11.2
Pod documented
340 10 my($self, $svg) = @_;
341  
342 10 foreach my $frame ($self->frames){
343 #warn $frame;
344 0 $frame->draw($self);
345 }
346  
347 10 foreach my $glyph ($self->glyphs){
348 #warn $glyph;
349 14 $glyph->draw($self);
350 }
351 }
352  
353 =head2 _recalculate_stats
354  
355 Title : _recalculate_stats
356 Usage :
357 Function:
358 Example :
359 Returns :
360 Args :
361  
362  
363 =cut
364  
365 487 ▶sub _recalculate_stats{
Subroutine _recalculate_stats: called CC=15 SCAR=33.5
366 487 my ($self,@args) = @_;
367 487 ▶ return undef unless $self->is_changed;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_changed 479 8 487
368  
369 8 my $xstat = Statistics::Descriptive::Full->new();
370 8 my $ystat = Statistics::Descriptive::Full->new();
371 8 my $zstat = Statistics::Descriptive::Full->new();
372  
373 #right now we only support y-stacking. this may need to be extended in the future
374 8 ▶ if($self->stack){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->stack) { } 0 8 8
375 0 my @ystack;
376 0 foreach my $data ($self->data_chunks){
377 0 my $i = 0;
378 0 foreach my $datum ($data->data){
379 0 $ystack[$i] += $datum->y;
380 0 $i++;
381 }
382 }
383  
384 0 $ystat->add_data($_) foreach @ystack;
385 } else {
386 8 ▶ $ystat->add_data(map {ref($_) && $_->can('y') ? $_->y : $_} map {$_->can('data') ? $_->data : $_->y} $self->all_data);
Branch: 2 branches
BranchTrueFalseTotal
ref $_ && $_->can('y') ? : 0 160 160
$_->can('data') ? : 0 160 160
Condition33%1/3
ref $_ and $_->can("y")
!ll&&!rl&&r
16000
MC/DC0%0/2
ref $_ and $_->can("y")
ref $_ $_->can("y")
Truth table33%1/3
A and B
A= ref $_B= $_->can("y")
ABresult
0X0
100
111
387  
388 }
389  
390 8 ▶ $xstat->add_data(map {ref($_) && $_->can('x') ? $_->x : $_} map {$_->can('data') ? $_->data : $_->x} $self->all_data);
Branch: 2 branches
BranchTrueFalseTotal
ref $_ && $_->can('x') ? : 0 160 160
$_->can('data') ? : 0 160 160
Condition33%1/3
ref $_ and $_->can("x")
!ll&&!rl&&r
16000
MC/DC0%0/2
ref $_ and $_->can("x")
ref $_ $_->can("x")
Truth table33%1/3
A and B
A= ref $_B= $_->can("x")
ABresult
0X0
100
111
391 8 ▶ $zstat->add_data(map {ref($_) && $_->can('z') ? $_->z : $_} map {$_->can('data') ? $_->data : $_->z} $self->all_data);
Branch: 2 branches
BranchTrueFalseTotal
ref $_ && $_->can('z') ? : 0 160 160
$_->can('data') ? : 0 160 160
Condition33%1/3
ref $_ and $_->can("z")
!ll&&!rl&&r
16000
MC/DC0%0/2
ref $_ and $_->can("z")
ref $_ $_->can("z")
Truth table33%1/3
A and B
A= ref $_B= $_->can("z")
ABresult
0X0
100
111
392  
393 8 $self->xstat($xstat);
394 8 $self->ystat($ystat);
395 8 $self->zstat($zstat);
396  
397 8 $self->is_changed(0);
398 }
399  
400 =head2 _parent_svg
401  
402 Title : _parent_svg
403 Usage : $obj->_parent_svg($newval)
404 Function:
405 Example :
406 Returns : value of _parent_svg (a scalar)
407 Args : on set, new value (a scalar or undef, optional)
408  
409  
410 =cut
411  
412 20 ▶sub _parent_svg{
Subroutine _parent_svg: called CC=2 SCAR=6.9
413 20 my $self = shift;
414  
415 20 ▶ return $self->{'_parent_svg'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 10 10 20
416 10 return $self->{'_parent_svg'};
417 }
418  
419 =head2 _parent_frame
420  
421 Title : _parent_frame
422 Usage : $obj->_parent_frame($newval)
423 Function:
424 Example :
425 Returns : value of _parent_frame (a scalar)
426 Args : on set, new value (a scalar or undef, optional)
427  
428  
429 =cut
430  
431 0 ▶sub add__parent_frame{return shift->_parent_frame(@_)}
Subroutine add__parent_frame: not called CC=1 SCAR=6.9
Pod undocumented
432 48 ▶sub _parent_frame{
Subroutine _parent_frame: called CC=2 SCAR=7.1
433 48 my $self = shift;
434  
435 48 ▶ return $self->{'_parent_frame'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 48 48
436 48 return $self->{'_parent_frame'};
437 }
438  
439 =head2 svg
440  
441 Title : svg
442 Usage : $obj->svg($newval)
443 Function:
444 Example :
445 Returns : value of svg (a scalar)
446 Args : on set, new value (a scalar or undef, optional)
447  
448  
449 =cut
450  
451 34 ▶sub svg{
Subroutine svg: called CC=2 SCAR=6.9
Pod documented
452 34 my $self = shift;
453  
454 34 ▶ return $self->{'svg'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 20 14 34
455 14 return $self->{'svg'};
456 }
457  
458 =head2 xsize
459  
460 Title : xsize
461 Usage : $obj->xsize($newval)
462 Function:
463 Example :
464 Returns : value of xsize (a scalar)
465 Args : on set, new value (a scalar or undef, optional)
466  
467  
468 =cut
469  
470 10 ▶sub add_xsize {return shift->xsize(@_)}
Subroutine add_xsize: called CC=1 SCAR=0.0
Pod undocumented
471 24 ▶sub xsize{
Subroutine xsize: called CC=2 SCAR=6.9
Pod documented
472 24 my $self = shift;
473  
474 24 ▶ return $self->{'xsize'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 10 14 24
475 14 return $self->{'xsize'};
476 }
477  
478 =head2 ysize
479  
480 Title : ysize
481 Usage : $obj->ysize($newval)
482 Function:
483 Example :
484 Returns : value of ysize (a scalar)
485 Args : on set, new value (a scalar or undef, optional)
486  
487  
488 =cut
489  
490 10 ▶sub add_ysize {return shift->ysize(@_)}
Subroutine add_ysize: called CC=1 SCAR=0.0
Pod undocumented
491 24 ▶sub ysize{
Subroutine ysize: called CC=2 SCAR=6.9
Pod documented
492 24 my $self = shift;
493  
494 24 ▶ return $self->{'ysize'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 10 14 24
495 14 return $self->{'ysize'};
496 }
497  
498 =head2 xoffset
499  
500 Title : xoffset
501 Usage : $obj->xoffset($newval)
502 Function:
503 Example :
504 Returns : value of xoffset (a scalar)
505 Args : on set, new value (a scalar or undef, optional)
506  
507  
508 =cut
509  
510 10 ▶sub add_xoffset {return shift->xoffset(@_)}
Subroutine add_xoffset: called CC=1 SCAR=0.0
Pod undocumented
511 24 ▶sub xoffset{
Subroutine xoffset: called CC=2 SCAR=6.9
Pod documented
512 24 my $self = shift;
513  
514 24 ▶ return $self->{'xoffset'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 10 14 24
515 14 return $self->{'xoffset'};
516 }
517  
518 =head2 yoffset
519  
520 Title : yoffset
521 Usage : $obj->yoffset($newval)
522 Function:
523 Example :
524 Returns : value of yoffset (a scalar)
525 Args : on set, new value (a scalar or undef, optional)
526  
527  
528 =cut
529  
530 10 ▶sub add_yoffset {return shift->yoffset(@_)}
Subroutine add_yoffset: called CC=1 SCAR=0.0
Pod undocumented
531 24 ▶sub yoffset{
Subroutine yoffset: called CC=2 SCAR=6.9
Pod documented
532 24 my $self = shift;
533  
534 24 ▶ return $self->{'yoffset'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 10 14 24
535 14 return $self->{'yoffset'};
536 }
537  
538 =head2 xmin
539  
540 Title : xmin
541 Usage : $obj->xmin($newval)
542 Function:
543 Example :
544 Returns : value of xmin (a scalar)
545 Args : on set, new value (a scalar or undef, optional)
546  
547  
548 =cut
549  
550 210 ▶sub xmin{
Subroutine xmin: called CC=3 SCAR=11.3
Pod documented
551 210 my $self = shift;
552  
553 210 ▶ return $self->{'xmin'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 210 210
554 210 ▶ return $self->{'xmin'} if defined $self->{'xmin'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"xmin"} 0 210 210
555 210 $self->_recalculate_stats();
556 210 return $self->xstat->min;
557  
558 }
559  
560 =head2 xmax
561  
562 Title : xmax
563 Usage : $obj->xmax($newval)
564 Function:
565 Example :
566 Returns : value of xmax (a scalar)
567 Args : on set, new value (a scalar or undef, optional)
568  
569  
570 =cut
571  
572 31 ▶sub xmax{
Subroutine xmax: called CC=3 SCAR=11.3
Pod documented
573 31 my $self = shift;
574  
575 31 ▶ return $self->{'xmax'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 31 31
576 31 ▶ return $self->{'xmax'} if defined $self->{'xmax'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"xmax"} 0 31 31
577 31 $self->_recalculate_stats();
578 31 return $self->xstat->max;
579  
580 }
581  
582 =head2 ymin
583  
584 Title : ymin
585 Usage : $obj->ymin($newval)
586 Function:
587 Example :
588 Returns : value of ymin (a scalar)
589 Args : on set, new value (a scalar or undef, optional)
590  
591  
592 =cut
593  
594 210 ▶sub ymin{
Subroutine ymin: called CC=3 SCAR=11.3
Pod documented
595 210 my $self = shift;
596  
597 210 ▶ return $self->{'ymin'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 210 210
598 210 ▶ return $self->{'ymin'} if defined $self->{'ymin'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"ymin"} 0 210 210
599 210 $self->_recalculate_stats();
600 210 return $self->ystat->min;
601  
602 }
603  
604 =head2 ymax
605  
606 Title : ymax
607 Usage : $obj->ymax($newval)
608 Function:
609 Example :
610 Returns : value of ymax (a scalar)
611 Args : on set, new value (a scalar or undef, optional)
612  
613  
614 =cut
615  
616 31 ▶sub ymax{
Subroutine ymax: called CC=3 SCAR=11.3
Pod documented
617 31 my $self = shift;
618  
619 31 ▶ return $self->{'ymax'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 31 31
620 31 ▶ return $self->{'ymax'} if defined $self->{'ymax'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"ymax"} 0 31 31
621 31 $self->_recalculate_stats();
622 31 return $self->ystat->max;
623  
624 }
625  
626 =head2 xrange
627  
628 Title : xrange
629 Usage : $obj->xrange($newval)
630 Function:
631 Example :
632 Returns : value of xrange (a scalar)
633  
634  
635 =cut
636  
637 31 ▶sub xrange{
Subroutine xrange: called CC=1 SCAR=0.0
Pod documented
638 31 my $self = shift;
639  
640 31 return $self->xmax - $self->xmin;
641 }
642  
643 =head2 yrange
644  
645 Title : yrange
646 Usage : $obj->yrange($newval)
647 Function:
648 Example :
649 Returns : value of yrange (a scalar)
650  
651  
652 =cut
653  
654 31 ▶sub yrange{
Subroutine yrange: called CC=1 SCAR=0.0
Pod documented
655 31 my $self = shift;
656  
657 31 return $self->ymax - $self->ymin;
658 }
659  
660 =head2 stack
661  
662 Title : stack
663 Usage : $obj->stack($newval)
664 Function:
665 Example :
666 Returns : value of stack (a scalar)
667 Args : on set, new value (a scalar or undef, optional)
668  
669  
670 =cut
671  
672 8 ▶sub stack{
Subroutine stack: called CC=2 SCAR=7.1
Pod documented
673 8 my $self = shift;
674  
675 8 ▶ return $self->{'stack'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 8 8
676 8 return $self->{'stack'};
677 }
678  
679 10 ▶sub add_frame_transform{return shift->frame_transform(@_)}
Subroutine add_frame_transform: called CC=1 SCAR=0.0
Pod undocumented
680 50 ▶sub frame_transform {
Subroutine frame_transform: called CC=3 SCAR=11.1
Pod undocumented
681 50 my $self = shift;
682  
683 50 ▶ return $self->{'frame_transform'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 10 40 50
684 40 ▶ return $self->{'frame_transform'} if defined $self->{'frame_transform'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"frame_transform"} 0 40 40
685 }
686  
687 7 1;
« Graph/Glyph/bar.pm ↑ Summary Graph/File.pm »