line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id$ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Google::Chart::Data::Simple; |
4
|
1
|
|
|
1
|
|
5
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
5
|
1
|
|
|
1
|
|
8017
|
use Scalar::Util qw(looks_like_number); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
95
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
with 'Google::Chart::Data'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
no Moose; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
8
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my @map = ('A'..'Z', 'a'..'z', 0..9); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub parameter_value { |
16
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
17
|
0
|
|
|
|
|
|
my $max = $self->max_value; |
18
|
0
|
|
|
|
|
|
my $size = @map - 1; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $result = ''; |
21
|
0
|
|
|
|
|
|
foreach my $data ($self->dataset) { |
22
|
0
|
|
|
|
|
|
my $v = '_'; |
23
|
0
|
0
|
0
|
|
|
|
if (defined $data && looks_like_number($data)) { |
24
|
0
|
|
|
|
|
|
my $index = int($data / $max * $size); |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
if ($index < 0) { |
|
|
0
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$index = 0; |
28
|
|
|
|
|
|
|
} elsif ($index > @map) { |
29
|
0
|
|
|
|
|
|
$index = $size; |
30
|
|
|
|
|
|
|
} |
31
|
0
|
|
|
|
|
|
$v = $map[$index]; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$result .= $v; |
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
|
return $result; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
package # hide from PAUSE |
40
|
|
|
|
|
|
|
Google::Chart::Data::Simple::DataSet; |
41
|
1
|
|
|
1
|
|
467
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
42
|
1
|
|
|
1
|
|
7750
|
use Moose::Util::TypeConstraints; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
13
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
subtype 'Google::Chart::Data::Simple::DataSet::Value' |
45
|
|
|
|
|
|
|
=> as 'Num' |
46
|
|
|
|
|
|
|
=> where { |
47
|
|
|
|
|
|
|
/^[A-Za-z0-9\-\.]{2}$/ |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has 'data' => ( |
52
|
|
|
|
|
|
|
is => 'rw', |
53
|
|
|
|
|
|
|
isa => 'ArrayRef[Maybe[Google::Chart::Data::Simple::DataSet::Value]]', |
54
|
|
|
|
|
|
|
required => 1, |
55
|
|
|
|
|
|
|
default => sub { +[] } |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
1
|
|
2681
|
no Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
61
|
1
|
|
|
1
|
|
240
|
no Moose::Util::TypeConstraints; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub as_string { |
64
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
65
|
0
|
|
|
|
|
|
return join(',', @{$self->data}); |
|
0
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 NAME |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Google::Chart::Data::Simple - Google::Chart Simple Data Encoding |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SYNOPSIS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 METHODS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 parameter_value |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |