SVG-Template-Graph
view release on metacpan or search on metacpan
lib/SVG/Template/Graph.pm view on Meta::CPAN
carp(
"No text was supplied. Either supply a string or an array reference containing strings"
)
unless scalar @$text;
my $tg = $self->_gg($id);
my $to = $tg->text(%attrs)
|| carp("Failed to generate an Axis text element within group '$id'.");
my %args = ( x => 0 );
foreach my $line (@$text) {
$to->tspan(%args)->cdata($line)
|| carp(
"Failed to generate an Axis tspan element within group '$id'.");
#set the dy spacing for multi-line text
$args{dy} = '1em';
}
return $to;
}
=head2 struct $struct
lib/SVG/Template/Graph.pm view on Meta::CPAN
#decide what to print as a gridline label
my $thistext = defined $self->{grid}->{"${o}_l"}
? #if labels are defined
$string
: $self->{grid}->{line}->{"d$o"}; #use data positions instead
$thistext =~ s/\s$//;
return $o eq 'y'
? $args->{anchor}
->text( y => $self->{grid}->{line}->{cy}, x => $self->T->cx0, )
->cdata($thistext)
: $args->{anchor}
->text( x => $self->{grid}->{line}->{cx}, y => $self->T->cy0, )
->cdata($thistext);
# $args->{anchor}->line(
# y1=> $o eq 'y' ? $self->{grid}->{line}->{cy} : $t->cy0,
# x1=> $o eq 'y' ? $t->cx0 : $self->{grid}->{line}->{cx},
# y2=> $o eq 'y' ? $self->{grid}->{line}->{cy} : $t->cy1,
# x2=> $o eq 'y' ? $t->cx1 : $self->{grid}->{line}->{y},
# );
}
( run in 0.662 second using v1.01-cache-2.11-cpan-454fe037f31 )