| 1 | package SVG::Graph::Glyph::bubble; | ||
| 2 | |||
| 3 | 2 | ▶ | use base SVG::Graph::Glyph; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | 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 | 5 | ▶ | sub draw{ |
|
Subroutine
draw: called CC=2 SCAR=6.9
Pod
documented
| |||
| 19 | 5 | my ($self,@args) = @_; | |
| 20 | |||
| 21 | 5 | my $id = 'n'.sprintf("%07d",int(rand(9999999))); | |
| 22 | 5 | my $group = $self->svg->group(id=>"bubble$id"); | |
| 23 | |||
| 24 | 5 | my $xscale = $self->xsize / $self->group->xrange; | |
| 25 | 5 | my $yscale = $self->ysize / $self->group->yrange; | |
| 26 | 5 | my $zscale = 30 / $self->group->zrange; | |
| 27 | |||
| 28 | 5 | foreach my $datum($self->group->data){ | |
| 29 | 100 | my $cx = (($datum->x - $self->group->xmin) * $xscale) + $self->xoffset; | |
| 30 | 100 | my $cy = (($self->xsize - ($datum->y - $self->group->ymin) * $yscale)) + $self->yoffset; | |
| 31 | |||
| 32 | 100 | my $r = $zscale * ($datum->z + 0.001); | |
| 33 | |||
| 34 | 100 | $group->circle(cx=>$cx,cy=>$cy,r=>$r,style=>{$self->_style}); | |
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | 2 | 1; | |