Skip to content
This repository has been archived by the owner on Feb 20, 2018. It is now read-only.

Commit

Permalink
Added Google::Chart::Title support in Google::Chart
Browse files Browse the repository at this point in the history
Signed-off-by: lestrrat <lestrrat+github@gmail.com>
  • Loading branch information
mschilli authored and lestrrat committed Apr 30, 2009
1 parent ac69997 commit 6b58974
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -3,6 +3,7 @@ Changes

0.05014 - (not yet released)
(ms) Added support for XY type graphs
(ms) Added Google::Chart::Title support in Google::Chart

0.05013 - 30 Jan 2009
* Explicitly require Test::More 0.82 (rt #42907)
Expand Down
8 changes: 7 additions & 1 deletion lib/Google/Chart.pm
Expand Up @@ -11,6 +11,7 @@ use Google::Chart::Data;
use Google::Chart::Size;
use Google::Chart::Type;
use Google::Chart::Types;
use Google::Chart::Title;
use LWP::UserAgent;
use URI;
use overload
Expand Down Expand Up @@ -72,7 +73,12 @@ my %COMPONENTS = (
is => 'rw',
does => 'Google::Chart::Fill',
coerce => 1
}
},
title => {
is => 'rw',
does => 'Google::Chart::Title',
coerce => 1
},
);
my @COMPONENTS = keys %COMPONENTS;

Expand Down
12 changes: 10 additions & 2 deletions lib/Google/Chart/Title.pm
Expand Up @@ -3,6 +3,14 @@
package Google::Chart::Title;
use Moose;
use Google::Chart::Types;
use Moose::Util::TypeConstraints;

coerce 'Google::Chart::Title'
=> from 'HashRef'
=> via {
Google::Chart::Title->new(%$_);
}
;

with 'Google::Chart::QueryComponent';

Expand All @@ -29,7 +37,7 @@ no Moose;
sub as_query {
my $self = shift;

my $text = $self->title;
my $text = $self->text;
$text =~ s/\r?\n/|/gsm;
my %data = (
chtt => $text
Expand Down Expand Up @@ -60,4 +68,4 @@ Google::Chart::Title - Apply Title
=head2 as_query
=cut
=cut

0 comments on commit 6b58974

Please sign in to comment.