Graph/Glyph/line.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 94.2% 33 / 35 CC 4 SCAR 11.0
CC
4
Cov
97%
draw
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Graph/Glyph/wedge.pm ↑ Summary Graph/Glyph.pm »
1 package SVG::Graph::Glyph::line;
2  
3 1 ▶use base SVG::Graph::Glyph;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head2 draw
7  
8 Title : draw
9 Usage :
10 Function:
11 Example :
12 Returns :
13 Args :
14  
15  
16 =cut
17  
18 1 ▶sub draw{
Subroutine draw: called CC=4 SCAR=13.9
Pod documented
19 1 my ($self,@args) = @_;
20  
21 1 my $id = 'n'.sprintf("%07d",int(rand(9999999)));
22 1 my $group = $self->svg->group(id=>"line$id");
23  
24 1 my $xscale = $self->xsize / $self->group->xrange;
25 1 my $yscale = $self->ysize / $self->group->yrange;
26  
27 1 my($x1,$x2,$y1,$y2);
28 1 foreach my $datum (sort {$a->x <=> $b->x} $self->group->data){
29 20 ▶ if(!defined($x1) and !defined($y1)){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $x1 or defined $y1) 1 19 20
Condition66%2/3
defined $x1 or defined $y1
l!l&&r!l&&!r
1901
MC/DC50%1/2
defined $x1 or defined $y1
defined $x1 defined $y1
Truth table66%2/3
A or B
A= defined $x1B= defined $y1
ABresult
1X1
011
000
30 1 $x1 = (($datum->x - $self->group->xmin) * $xscale) + $self->xoffset;
31 1 $y1 = ($self->ysize - ($datum->y - $self->group->ymin) * $yscale) + $self->yoffset;
32 1 next;
33 }
34  
35 19 $x2 = (($datum->x - $self->group->xmin) * $xscale) + $self->xoffset;
36 19 $y2 = ($self->ysize - ($datum->y - $self->group->ymin) * $yscale) + $self->yoffset;
37  
38 19 $group->line(x1=>$x1,y1=>$y1,x2=>$x2,y2=>$y2,style=>{$self->_style});
39  
40 19 $x1 = $x2;
41 19 $y1 = $y2;
42 }
43 }
44  
45 1 1;
« Graph/Glyph/wedge.pm ↑ Summary Graph/Glyph.pm »