diff --git a/Changes b/Changes index 82a8cbe..a934f57 100644 --- a/Changes +++ b/Changes @@ -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) diff --git a/lib/Google/Chart.pm b/lib/Google/Chart.pm index e5805bc..950f2a1 100644 --- a/lib/Google/Chart.pm +++ b/lib/Google/Chart.pm @@ -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 @@ -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; diff --git a/lib/Google/Chart/Title.pm b/lib/Google/Chart/Title.pm index ff62f9f..4e1121c 100644 --- a/lib/Google/Chart/Title.pm +++ b/lib/Google/Chart/Title.pm @@ -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'; @@ -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 @@ -60,4 +68,4 @@ Google::Chart::Title - Apply Title =head2 as_query -=cut \ No newline at end of file +=cut