Skip Menu |

This queue is for tickets about the Chart-OFC CPAN distribution.

Report information
The Basics
Id: 76210
Status: new
Priority: 0/
Queue: Chart-OFC

People
Owner: Nobody in particular
Requestors: dada [...] perl.it
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.11
Fixed in: (no value)



Subject: Support for tool_tips "extra" attribute
Attached a patch for Chart::OFC that adds support for tool_tips attribute in Dataset.pm (cfr. http://teethgrinder.co.uk/open-flash-chart/gallery-tool-tip-line.php). It also fixes some wrong references to Chloro in dist.ini. The patch comes with documentation and test case. cheers, Aldo
Subject: chart-ofc-tool_tips.patch
diff --git a/dist.ini b/dist.ini index f6e2ee8..bb16757 100644 --- a/dist.ini +++ b/dist.ini @@ -14,10 +14,10 @@ format = %-8v %{yyyy-MM-dd}d [MetaJSON] [MetaResources] -bugtracker.web = http://rt.cpan.org/NoAuth/Bugs.html?Dist=Chloro -bugtracker.mailto = bug-chloro@rt.cpan.org -repository.url = git://git.urth.org/Chloro.git -repository.web = http://git.urth.org/Chloro.git +bugtracker.web = http://rt.cpan.org/NoAuth/Bugs.html?Dist=Chart-OFC +bugtracker.mailto = bug-chart-ofc@rt.cpan.org +repository.url = git://git.urth.org/Chart-OFC.git +repository.web = http://git.urth.org/Chart-OFC.git repository.type = git [SurgicalPodWeaver] diff --git a/lib/Chart/OFC/Dataset.pm b/lib/Chart/OFC/Dataset.pm index 4d9dc76..9ac7835 100644 --- a/lib/Chart/OFC/Dataset.pm +++ b/lib/Chart/OFC/Dataset.pm @@ -24,6 +24,14 @@ has 'links' => predicate => 'has_links', ); +has 'tool_tips' => + ( is => 'ro', + isa => 'Chart::OFC::Type::NonEmptyArrayRef', + required => 0, + auto_deref => 1, + predicate => 'has_tool_tips', + ); + sub _ofc_data_lines { my $self = shift; @@ -56,6 +64,14 @@ sub _ofc_data_lines push @lines, $self->_data_line( $links_name, $self->links() ); } + if ( $self->has_tool_tips() ) + { + my $tool_tips_name = 'tool_tips_set'; + $tool_tips_name .= q{ } . $count + if $count && $count > 1; + push @lines, $self->_data_line( $tool_tips_name, $self->tool_tips() ); + } + return @lines; } @@ -99,6 +115,14 @@ This attribute is required, and must contain at least one value. This is an optional attribute which may be an array reference of links, one per value. +=head2 tool_tips + +This is an optional attribute which may be an array reference of +tooltip extra strings, one per value. Use C<#tip#> in L<Chart::OFC> +C<tool_tip> attribute to display those strings. +See http://teethgrinder.co.uk/open-flash-chart/gallery-tool-tip-line.php +for details. + =head1 ROLES This class does the C<Chart::OFC::Role::OFCDataLines> role. diff --git a/t/Dataset.t b/t/Dataset.t index 370f148..ec1a24f 100644 --- a/t/Dataset.t +++ b/t/Dataset.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 6; use Chart::OFC::Dataset; @@ -28,3 +28,8 @@ use Chart::OFC::Dataset; 'check values() attribute, mixed ints and floats are ok' ); } +{ + my $ds = Chart::OFC::Dataset->new( values => [ 1, 2 ], tool_tips => [ 'foo', 'bar' ] ); + is_deeply( [ $ds->tool_tips() ], [ 'foo', 'bar' ], 'check tool_tips() attribute' ); +} +