line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id$ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Google::Chart::Data::Text; |
4
|
1
|
|
|
1
|
|
6
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with 'Google::Chart::Data'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has '+dataset' => ( |
9
|
|
|
|
|
|
|
isa => 'ArrayRef[Google::Chart::Data::Text::DataSet]', |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
7994
|
no Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub BUILDARGS { |
17
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# A dataset must be an array of arrays or array of values |
20
|
0
|
|
|
|
|
|
my @dataset; |
21
|
|
|
|
|
|
|
my @dataargs; |
22
|
0
|
|
|
|
|
|
my %args; |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
0
|
|
|
|
if (@_ == 1 && ref $_[0] eq 'ARRAY') { |
25
|
0
|
|
|
|
|
|
@dataargs = @{$_[0]}; |
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
} else { |
27
|
0
|
|
|
|
|
|
%args = @_; |
28
|
0
|
0
|
|
|
|
|
@dataargs = @{ delete $args{dataset} || [] }; |
|
0
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
if (! ref $dataargs[0] ) { |
32
|
0
|
|
|
|
|
|
@dataargs = ([ @dataargs]); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
foreach my $dataset ( @dataargs ) { |
36
|
0
|
0
|
|
|
|
|
if (! Scalar::Util::blessed $dataset) { |
37
|
0
|
|
|
|
|
|
$dataset = Google::Chart::Data::Text::DataSet->new(data => $dataset) |
38
|
|
|
|
|
|
|
} |
39
|
0
|
|
|
|
|
|
push @dataset, $dataset; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return { %args, dataset => \@dataset } |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub parameter_value { |
46
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
47
|
0
|
|
|
|
|
|
sprintf('t:%s', |
48
|
0
|
|
|
|
|
|
join( '|', map { $_->as_string } @{ $self->dataset } ) ) |
|
0
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
package # hide from PAUSE |
52
|
|
|
|
|
|
|
Google::Chart::Data::Text::DataSet; |
53
|
1
|
|
|
1
|
|
501
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
54
|
1
|
|
|
1
|
|
7644
|
use Moose::Util::TypeConstraints; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
subtype 'Google::Chart::Data::Text::DataSet::Value' |
57
|
|
|
|
|
|
|
=> as 'Num' |
58
|
|
|
|
|
|
|
=> where { |
59
|
|
|
|
|
|
|
($_ >= 0 && $_ <= 100) || $_ == -1 |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has 'data' => ( |
64
|
|
|
|
|
|
|
is => 'rw', |
65
|
|
|
|
|
|
|
isa => 'ArrayRef[Maybe[Google::Chart::Data::Text::DataSet::Value]]', |
66
|
|
|
|
|
|
|
required => 1, |
67
|
|
|
|
|
|
|
default => sub { +[] } |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
1
|
|
2714
|
no Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
73
|
1
|
|
|
1
|
|
272
|
no Moose::Util::TypeConstraints; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub as_string { |
76
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
77
|
0
|
|
|
|
|
|
return join(',', map { sprintf('%0.1f', $_) } @{$self->data}); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 NAME |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Google::Chart::Data::Text - Google::Chart Text Encoding |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SYNOPSIS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Google::Chart->new( |
91
|
|
|
|
|
|
|
data => { |
92
|
|
|
|
|
|
|
type => "Text", |
93
|
|
|
|
|
|
|
dataset => [ .... ] |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 METHODS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 parameter_value |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |