File Coverage

blib/lib/Spreadsheet/WriteExcel/Chart/Pie.pm
Criterion Covered Total %
statement 26 34 76.4
branch n/a
condition n/a
subroutine 5 6 83.3
pod 0 1 0.0
total 31 41 75.6


line stmt bran cond sub pod time code
1             package Spreadsheet::WriteExcel::Chart::Pie;
2              
3             ###############################################################################
4             #
5             # Pie - A writer class for Excel Pie 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             require Exporter;
17              
18 1     1   6 use strict;
  1         1  
  1         39  
19 1     1   6 use Spreadsheet::WriteExcel::Chart;
  1         2  
  1         46  
20              
21              
22 1     1   6 use vars qw($VERSION @ISA);
  1         2  
  1         348  
23             @ISA = qw(Spreadsheet::WriteExcel::Chart Exporter);
24              
25             $VERSION = '2.40';
26              
27             ###############################################################################
28             #
29             # new()
30             #
31             #
32             sub new {
33              
34 1     1 0 2 my $class = shift;
35 1         6 my $self = Spreadsheet::WriteExcel::Chart->new( @_ );
36              
37 1         2 $self->{_vary_data_color} = 1;
38              
39 1         3 bless $self, $class;
40 1         4 return $self;
41             }
42              
43              
44             ###############################################################################
45             #
46             # _store_chart_type()
47             #
48             # Implementation of the abstract method from the specific chart class.
49             #
50             # Write the Pie chart BIFF record.
51             #
52             sub _store_chart_type {
53              
54 1     1   149 my $self = shift;
55              
56 1         3 my $record = 0x1019; # Record identifier.
57 1         2 my $length = 0x0006; # Number of bytes to follow.
58 1         2 my $angle = 0x0000; # Angle.
59 1         2 my $donut = 0x0000; # Donut hole size.
60 1         2 my $grbit = 0x0002; # Option flags.
61              
62 1         5 my $header = pack 'vv', $record, $length;
63 1         2 my $data = '';
64 1         3 $data .= pack 'v', $angle;
65 1         2 $data .= pack 'v', $donut;
66 1         2 $data .= pack 'v', $grbit;
67              
68 1         11 $self->_append( $header, $data );
69             }
70              
71              
72             ###############################################################################
73             #
74             # _store_axisparent_stream(). Overridden.
75             #
76             # Write the AXISPARENT chart substream.
77             #
78             # A Pie chart has no X or Y axis so we override this method to remove them.
79             #
80             sub _store_axisparent_stream {
81              
82 0     0     my $self = shift;
83              
84 0           $self->_store_axisparent( @{ $self->{_config}->{_axisparent} } );
  0            
85              
86 0           $self->_store_begin();
87 0           $self->_store_pos( @{ $self->{_config}->{_axisparent_pos} } );
  0            
88              
89 0           $self->_store_chartformat_stream();
90 0           $self->_store_end();
91             }
92              
93              
94             1;
95              
96              
97             __END__