Chart/Axis.pm

filter: Statementstmt 46.8% 22 / 47 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 100% 1 / 1 totaltotal 43.7% 28 / 64 CC 8 SCAR 33.1
CC
8
Cov
40%
as_query
56.0
__ANON__
6.0
__ANON__
2.0
CRAP 27.4
« Chart/Marker.pm ↑ Summary Chart/Data/Extended.pm »
1 # $Id$
2  
3 package Google::Chart::Axis;
4 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Google::Chart::Axis::Item;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 with 'Google::Chart::QueryComponent';
9  
10 coerce 'Google::Chart::Axis'
11 => from 'ArrayRef[HashRef]'
12 0 ▶ => via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
13 0 Google::Chart::Axis->new(axes => $_);
14 }
15 1 ;
16  
17 1 subtype 'Google::Chart::Axis::ItemList'
18 => as 'ArrayRef[Google::Chart::Axis::Item]'
19 ;
20  
21 coerce 'Google::Chart::Axis::ItemList'
22 => from 'ArrayRef'
23 0 ▶ => via {
Subroutine __ANON__: not called CC=2 SCAR=17.9
24 0 my @list;
25 0 foreach my $h (@$_) {
26 0 push @list, Google::Chart::Axis::Item->new(%$h);
27 }
28 0 return \@list;
29 }
30 1 ;
31  
32 1 has 'axes' => (
33 is => 'rw',
34 isa => 'Google::Chart::Axis::ItemList',
35 coerce => 1,
36 auto_deref => 1,
37 );
38  
39 1 __PACKAGE__->meta->make_immutable;
40  
41 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 1 ▶no Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 0 ▶sub as_query {
Subroutine as_query: not called CC=7 SCAR=40.3
Pod documented
45 0 my $self = shift;
46  
47 0 my (@chxt, @chxl, @chxp, @chxr, @chxs);
48 0 my %data = (
49 chxl => \@chxl,
50 chxp => \@chxp,
51 chxr => \@chxr,
52 chxs => \@chxs
53 );
54  
55 0 foreach my $axis ($self->axes) {
56 0 push @chxt, $axis->location;
57  
58 0 my $index = $#chxt;
59 0 ▶ if (my @labels = $axis->labels) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@labels) = $axis->labels) 0 0 0
60 0 push @chxl, join("|", "$index:", @labels);
61 }
62  
63 0 ▶ if (my @label_positions = $axis->label_positions) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@label_positions) = $axis->label_positions) 0 0 0
64 0 push @chxp, join(",", $index, @label_positions);
65 }
66  
67 0 ▶ if (my @range = $axis->range) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = $axis->range) 0 0 0
68 0 push @chxr, join(",", $index, @range);
69 }
70  
71 0 ▶ if (my @styles = $axis->styles) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@styles) = $axis->styles) 0 0 0
72 0 push @chxs, join(",", $index, map { $_->as_query } @styles);
73 }
74 }
75  
76 0 foreach my $key (keys %data) {
77 0 $data{$key} = join('|', @{$data{ $key }});
78 }
79 0 $data{chxt} = join(',', @chxt);
80  
81 0 return %data;
82 }
83  
84 1 1;
85  
86 __END__
« Chart/Marker.pm ↑ Summary Chart/Data/Extended.pm »