Skip to content

Commit

Permalink
Various tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Sep 26, 2016
1 parent 937b6d9 commit 633db55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bin/genesis
Expand Up @@ -3,4 +3,4 @@
TIMELINE=`dirname $0`
TIMELINE+="/timeline"
echo $TIMELINE
$TIMELINE --years_per_grid=100 --width=1000 --height=200 < genesis5.dat > genesis.svg
$TIMELINE --years_per_grid=100 < genesis5.dat > genesis.svg
17 changes: 9 additions & 8 deletions lib/Timeline/SVG.pm
Expand Up @@ -21,13 +21,13 @@ has events => (

has width => (
is => 'ro',
isa => 'Int',
isa => 'Str',
default => '100%',
);

has height => (
is => 'ro',
isa => 'Int',
isa => 'Str',
default => '100%',
);

Expand Down Expand Up @@ -79,6 +79,12 @@ has years_per_grid => (
default => 10, # One decade by default
);

has bar_height => (
is => 'ro',
isa => 'Int',
default => 50,
);

# Padding at the top and bottom of each person bar (in pixels)
has bar_padding => (
is => 'ro',
Expand Down Expand Up @@ -117,7 +123,7 @@ sub draw_grid{
stroke_width => 1
);
$self->text(
x => $x + 1,
x => $curr_year + 1,
y => 12,
'font-size' => $self->bar_height / 2
)->cdata($curr_year);
Expand Down Expand Up @@ -188,9 +194,4 @@ sub pixels_per_year {
return $self->width / $self->years;
}

sub bar_height {
my $self = shift;
return $self->height / ($self->count_events + 1);
}

1;

0 comments on commit 633db55

Please sign in to comment.