SVG-Timeline
view release on metacpan or search on metacpan
lib/SVG/Timeline.pm view on Meta::CPAN
SVG output. Unless you're using a subclass of this class for some reason,
there is no reason to set this manually.
=cut
has svg => (
is => 'ro',
isa => 'SVG',
lazy_build => 1,
clearer => '_clear_svg',
handles => [qw[xmlify line text rect cdata]],
);
sub _build_svg {
my $self = shift;
$_->{end} //= (localtime)[5] + 1900 foreach $self->all_events;
return SVG->new(
width => $self->width,
height => $self->height,
lib/SVG/Timeline.pm view on Meta::CPAN
y1 => 0,
x2 => $curr_year * $units_per_year,
y2 => $self->calculated_height,
stroke => $self->decade_line_colour,
stroke_width => 1
);
$self->text(
x => ($curr_year + 1) * $units_per_year,
y => 20,
'font-size' => $self->bar_height / 2
)->cdata($curr_year);
}
$curr_year++;
}
$self->rect(
x => $self->min_year * $units_per_year,
y => 0,
width => $self->years * $units_per_year,
height => ($self->bar_height * ($self->events_in_timeline + 1))
+ ($self->bar_height * $self->bar_spacing
lib/SVG/Timeline/Event.pm view on Meta::CPAN
height => $tl->bar_height,
fill => $self->colour // $tl->default_colour,
stroke => $tl->bar_outline_colour,
'stroke-width' => 1
);
$tl->text(
x => ($x + $tl->bar_height * 0.2),
y => $y + $tl->bar_height * 0.8,
'font-size' => $tl->bar_height * 0.8,
)->cdata($self->text);
}
no Moose;
__PACKAGE__->meta->make_immutable;
=head1 AUTHOR
Dave Cross <dave@perlhacks.com>
=head1 COPYRIGHT AND LICENCE
( run in 0.668 second using v1.01-cache-2.11-cpan-454fe037f31 )