Chart/Type/Bar.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 54 CC 3 SCAR 19.5
CC
3
Cov
0%
_build_type
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 7.0
1  
2 package Google::Chart::Type::Bar;
3 use Moose;
4 use Moose::Util::TypeConstraints;
5 use namespace::clean -except => qw(meta);
6  
7 extends 'Google::Chart';
8 with qw(
9 Google::Chart::WithAxis
10 Google::Chart::WithData
11 Google::Chart::WithGrid
12 Google::Chart::WithLinearGradientFill
13 Google::Chart::WithLinearStripe
14 Google::Chart::WithLineDrawStyle
15 Google::Chart::WithMarker
16 Google::Chart::WithRangeFill
17 Google::Chart::WithSolidFill
18 );
19  
20 has bar_zero => (
21 is => 'ro',
22 isa => 'Num',
23 predicate => 'has_bar_zero',
24 );
25  
26 has bar_space => (
27 is => 'ro',
28 isa => 'Int',
29 predicate => 'has_bar_space',
30 );
31  
32 has bar_width => (
33 is => 'ro',
34 isa => 'Int',
35 predicate => 'has_bar_width',
36 );
37  
38 has group_space => (
39 is => 'ro',
40 isa => 'Int',
41 predicate => 'has_group_space',
42 );
43
44 has orientation => (
45 is => 'ro',
46 isa => enum([ qw(horizontal vertical) ]),
47 default => 'vertical',
48 );
49  
50 has stacked => (
51 is => 'ro',
52 isa => 'Bool',
53 default => 0,
54 );
55  
56 sub _build_type {
57 my $self = shift;
58
59 return sprintf( 'b%s%s',
60 $self->orientation eq 'vertical' ? 'v' : 'h',
61 $self->stacked ? 's' : 'g'
62 );
63 }
64  
65 around prepare_query => sub {
66 my ($next, $self, @args) = @_;
67  
68 my @query = $next->($self, @args);
69 my @comps;
70 $comps[0] = $self->bar_width if $self->has_bar_width;
71 $comps[1] = $self->bar_space if $self->has_bar_space;
72 $comps[2] = $self->group_space if $self->has_group_space;
73 if (@comps > 0) {
74 push @query, (chbh => join(',', @comps));
75 }
76  
77 if ($self->has_bar_zero) {
78 push @query, (chp => $self->bar_zero);
79 }
80  
81 return @query;
82 };
83  
84 __PACKAGE__->meta->make_immutable;
85  
86 1;
87  
88 __END__