WriteExcel/Chart/Bar.pm

filter: Statementstmt 82.9% 34 / 41 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 81.2% 39 / 48 CC 1 SCAR 1.5
CC
1
Cov
83%
_set_embedded_config_data
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« WriteExcel/Chart/Pie.pm ↑ Summary WriteExcel/Chart/Area.pm »
1 package Spreadsheet::WriteExcel::Chart::Bar;
2  
3 ###############################################################################
4 #
5 # Bar - A writer class for Excel Bar charts.
6 #
7 # Used in conjunction with Spreadsheet::WriteExcel::Chart.
8 #
9 # See formatting note in Spreadsheet::WriteExcel::Chart.
10 #
11 # Copyright 2000-2010, John McNamara, jmcnamara@cpan.org
12 #
13 # Documentation after __END__
14 #
15  
16 1 require Exporter;
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use Spreadsheet::WriteExcel::Chart;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21  
22 1 ▶use vars qw($VERSION @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 @ISA = qw(Spreadsheet::WriteExcel::Chart Exporter);
24  
25 1 $VERSION = '2.40';
26  
27 ###############################################################################
28 #
29 # new()
30 #
31 #
32 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
33  
34 1 my $class = shift;
35 1 my $self = Spreadsheet::WriteExcel::Chart->new( @_ );
36  
37 1 bless $self, $class;
38  
39 # The axis positions are reversed for a bar chart so we change the config.
40 1 my $c = $self->{_config};
41 1 $c->{_x_axis_text} = [ 0x2D, 0x6D9, 0x5F, 0x1CC, 0x281, 0x0, 90 ];
42 1 $c->{_x_axis_text_pos} = [ 2, 2, 0, 0, 0x17, 0x2A ];
43 1 $c->{_y_axis_text} = [ 0x078A, 0x0DFC, 0x011D, 0x9C, 0x0081, 0x0000 ];
44 1 $c->{_y_axis_text_pos} = [ 2, 2, 0, 0, 0x45, 0x17 ];
45  
46 1 return $self;
47 }
48  
49  
50 ###############################################################################
51 #
52 # _store_chart_type()
53 #
54 # Implementation of the abstract method from the specific chart class.
55 #
56 # Write the BAR chart BIFF record. Defines a bar or column chart type.
57 #
58 1 ▶sub _store_chart_type {
Subroutine _store_chart_type: called CC=1 SCAR=0.0
59  
60 1 my $self = shift;
61  
62 1 my $record = 0x1017; # Record identifier.
63 1 my $length = 0x0006; # Number of bytes to follow.
64 1 my $pcOverlap = 0x0000; # Space between bars.
65 1 my $pcGap = 0x0096; # Space between cats.
66 1 my $grbit = 0x0001; # Option flags.
67  
68 1 my $header = pack 'vv', $record, $length;
69 1 my $data = '';
70 1 $data .= pack 'v', $pcOverlap;
71 1 $data .= pack 'v', $pcGap;
72 1 $data .= pack 'v', $grbit;
73  
74 1 $self->_append( $header, $data );
75 }
76  
77 ###############################################################################
78 #
79 # _set_embedded_config_data()
80 #
81 # Override some of the default configuration data for an embedded chart.
82 #
83 0 ▶sub _set_embedded_config_data {
Subroutine _set_embedded_config_data: not called CC=1 SCAR=6.9
84  
85 0 my $self = shift;
86  
87 # Set the parent configuration first.
88 0 $self->SUPER::_set_embedded_config_data();
89  
90 # The axis positions are reversed for a bar chart so we change the config.
91 0 my $c = $self->{_config};
92 0 $c->{_x_axis_text} = [ 0x57, 0x5BC, 0xB5, 0x214, 0x281, 0x0, 90 ];
93 0 $c->{_x_axis_text_pos} = [ 2, 2, 0, 0, 0x17, 0x2A ];
94 0 $c->{_y_axis_text} = [ 0x074A, 0x0C8F, 0x021F, 0x123, 0x81, 0x0000 ];
95 0 $c->{_y_axis_text_pos} = [ 2, 2, 0, 0, 0x45, 0x17 ];
96  
97 }
98  
99 1 1;
100  
101  
102 __END__
« WriteExcel/Chart/Pie.pm ↑ Summary WriteExcel/Chart/Area.pm »