File Coverage

blib/lib/Spreadsheet/WriteExcel/Chart/Stock.pm
Criterion Covered Total %
statement 20 41 48.7
branch n/a
condition n/a
subroutine 5 6 83.3
pod 0 1 0.0
total 25 48 52.0


line stmt bran cond sub pod time code
1             package Spreadsheet::WriteExcel::Chart::Stock;
2              
3             ###############################################################################
4             #
5             # Stock - A writer class for Excel Stock 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         2  
  1         34  
19 1     1   5 use Spreadsheet::WriteExcel::Chart;
  1         2  
  1         43  
20              
21              
22 1     1   5 use vars qw($VERSION @ISA);
  1         2  
  1         660  
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         3 bless $self, $class;
38 1         5 return $self;
39             }
40              
41              
42             ###############################################################################
43             #
44             # _store_chart_type()
45             #
46             # Implementation of the abstract method from the specific chart class.
47             #
48             # Write the LINE chart BIFF record. A stock chart uses the same LINE record
49             # as a line chart but with additional DROPBAR and CHARTLINE records to define
50             # the stock style.
51             #
52             sub _store_chart_type {
53              
54 1     1   131 my $self = shift;
55              
56 1         2 my $record = 0x1018; # Record identifier.
57 1         2 my $length = 0x0002; # Number of bytes to follow.
58 1         2 my $grbit = 0x0000; # Option flags.
59              
60 1         105 my $header = pack 'vv', $record, $length;
61 1         2 my $data = pack 'v', $grbit;
62              
63 1         11 $self->_append( $header, $data );
64             }
65              
66             ###############################################################################
67             #
68             # _store_marker_dataformat_stream(). Overridden.
69             #
70             # This is an implementation of the parent abstract method to define
71             # properties of markers, linetypes, pie formats and other.
72             #
73             sub _store_marker_dataformat_stream {
74              
75 0     0     my $self = shift;
76              
77 0           $self->_store_dropbar();
78 0           $self->_store_begin();
79 0           $self->_store_lineformat( 0x00000000, 0x0000, 0xFFFF, 0x0001, 0x004F );
80 0           $self->_store_areaformat( 0x00FFFFFF, 0x0000, 0x01, 0x01, 0x09, 0x08 );
81 0           $self->_store_end();
82              
83 0           $self->_store_dropbar();
84 0           $self->_store_begin();
85 0           $self->_store_lineformat( 0x00000000, 0x0000, 0xFFFF, 0x0001, 0x004F );
86 0           $self->_store_areaformat( 0x0000, 0x00FFFFFF, 0x01, 0x01, 0x08, 0x09 );
87 0           $self->_store_end();
88              
89 0           $self->_store_chartline();
90 0           $self->_store_lineformat( 0x00000000, 0x0000, 0xFFFF, 0x0000, 0x004F );
91              
92              
93 0           $self->_store_dataformat( 0x0000, 0xFFFD, 0x0000 );
94 0           $self->_store_begin();
95 0           $self->_store_3dbarshape();
96 0           $self->_store_lineformat( 0x00000000, 0x0005, 0xFFFF, 0x0000, 0x004F );
97 0           $self->_store_areaformat( 0x00000000, 0x0000, 0x00, 0x01, 0x4D, 0x4D );
98 0           $self->_store_pieformat();
99 0           $self->_store_markerformat( 0x00, 0x00, 0x00, 0x00, 0x4D, 0x4D, 0x3C );
100 0           $self->_store_end();
101              
102             }
103              
104              
105             1;
106              
107              
108             __END__