| 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 | 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 | $self->{_vary_data_color} = 1; | |
| 38 | |||
| 39 | 1 | bless $self, $class; | |
| 40 | 1 | 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 | 1 | ▶ | sub _store_chart_type { |
|
Subroutine
_store_chart_type: called CC=1 SCAR=0.0
| |||
| 53 | |||
| 54 | 1 | my $self = shift; | |
| 55 | |||
| 56 | 1 | my $record = 0x1019; # Record identifier. | |
| 57 | 1 | my $length = 0x0006; # Number of bytes to follow. | |
| 58 | 1 | my $angle = 0x0000; # Angle. | |
| 59 | 1 | my $donut = 0x0000; # Donut hole size. | |
| 60 | 1 | my $grbit = 0x0002; # Option flags. | |
| 61 | |||
| 62 | 1 | my $header = pack 'vv', $record, $length; | |
| 63 | 1 | my $data = ''; | |
| 64 | 1 | $data .= pack 'v', $angle; | |
| 65 | 1 | $data .= pack 'v', $donut; | |
| 66 | 1 | $data .= pack 'v', $grbit; | |
| 67 | |||
| 68 | 1 | $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 | 0 | ▶ | sub _store_axisparent_stream { |
|
Subroutine
_store_axisparent_stream: not called CC=1 SCAR=6.9
| |||
| 81 | |||
| 82 | 0 | my $self = shift; | |
| 83 | |||
| 84 | 0 | $self->_store_axisparent( @{ $self->{_config}->{_axisparent} } ); | |
| 85 | |||
| 86 | 0 | $self->_store_begin(); | |
| 87 | 0 | $self->_store_pos( @{ $self->{_config}->{_axisparent_pos} } ); | |
| 88 | |||
| 89 | 0 | $self->_store_chartformat_stream(); | |
| 90 | 0 | $self->_store_end(); | |
| 91 | } | ||
| 92 | |||
| 93 | |||
| 94 | 1 | 1; | |
| 95 | |||
| 96 | |||
| 97 | __END__ | ||