File Coverage

blib/lib/SVG/Graph/Glyph/bubble.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 21 21 100.0


line stmt bran cond sub pod time code
1             package SVG::Graph::Glyph::bubble;
2              
3 2     2   10 use base SVG::Graph::Glyph;
  2         3  
  2         1213  
4 2     2   13 use strict;
  2         5  
  2         475  
5              
6             =head2 draw
7              
8             Title : draw
9             Usage :
10             Function:
11             Example :
12             Returns :
13             Args :
14              
15              
16             =cut
17              
18             sub draw{
19 5     5 1 13 my ($self,@args) = @_;
20              
21 5         33 my $id = 'n'.sprintf("%07d",int(rand(9999999)));
22 5         25 my $group = $self->svg->group(id=>"bubble$id");
23              
24 5         374 my $xscale = $self->xsize / $self->group->xrange;
25 5         82 my $yscale = $self->ysize / $self->group->yrange;
26 5         43 my $zscale = 30 / $self->group->zrange;
27              
28 5         40 foreach my $datum($self->group->data){
29 100         5430 my $cx = (($datum->x - $self->group->xmin) * $xscale) + $self->xoffset;
30 100         239 my $cy = (($self->xsize - ($datum->y - $self->group->ymin) * $yscale)) + $self->yoffset;
31              
32 100         273 my $r = $zscale * ($datum->z + 0.001);
33              
34 100         271 $group->circle(cx=>$cx,cy=>$cy,r=>$r,style=>{$self->_style});
35             }
36             }
37              
38             1;