| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Excel::Writer::XLSX::Chart::Stock; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Stock - A class for writing Excel Stock charts. |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# Used in conjunction with Excel::Writer::XLSX::Chart. |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# See formatting note in Excel::Writer::XLSX::Chart. |
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# Copyright 2000-2019, John McNamara, jmcnamara@cpan.org |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# Documentation after __END__ |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# perltidy with the following options: -mbl=2 -pt=0 -nola |
|
17
|
|
|
|
|
|
|
|
|
18
|
13
|
|
|
13
|
|
3050
|
use 5.008002; |
|
|
13
|
|
|
|
|
44
|
|
|
19
|
13
|
|
|
13
|
|
66
|
use strict; |
|
|
13
|
|
|
|
|
32
|
|
|
|
13
|
|
|
|
|
256
|
|
|
20
|
13
|
|
|
13
|
|
57
|
use warnings; |
|
|
13
|
|
|
|
|
25
|
|
|
|
13
|
|
|
|
|
337
|
|
|
21
|
13
|
|
|
13
|
|
66
|
use Carp; |
|
|
13
|
|
|
|
|
36
|
|
|
|
13
|
|
|
|
|
807
|
|
|
22
|
13
|
|
|
13
|
|
91
|
use Excel::Writer::XLSX::Chart; |
|
|
13
|
|
|
|
|
28
|
|
|
|
13
|
|
|
|
|
6978
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @ISA = qw(Excel::Writer::XLSX::Chart); |
|
25
|
|
|
|
|
|
|
our $VERSION = '1.03'; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
############################################################################### |
|
29
|
|
|
|
|
|
|
# |
|
30
|
|
|
|
|
|
|
# new() |
|
31
|
|
|
|
|
|
|
# |
|
32
|
|
|
|
|
|
|
# |
|
33
|
|
|
|
|
|
|
sub new { |
|
34
|
|
|
|
|
|
|
|
|
35
|
13
|
|
|
13
|
0
|
894
|
my $class = shift; |
|
36
|
13
|
|
|
|
|
59
|
my $self = Excel::Writer::XLSX::Chart->new( @_ ); |
|
37
|
13
|
|
|
|
|
27
|
$self->{_show_crosses} = 0; |
|
38
|
13
|
|
|
|
|
31
|
$self->{_hi_low_lines} = {}; |
|
39
|
13
|
|
|
|
|
27
|
$self->{_date_category} = 1; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Override and reset the default axis values. |
|
42
|
13
|
|
|
|
|
27
|
$self->{_x_axis}->{_defaults}->{num_format} = 'dd/mm/yyyy'; |
|
43
|
13
|
|
|
|
|
46
|
$self->{_x2_axis}->{_defaults}->{num_format} = 'dd/mm/yyyy'; |
|
44
|
13
|
|
|
|
|
50
|
$self->set_x_axis(); |
|
45
|
13
|
|
|
|
|
49
|
$self->set_x2_axis(); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Set the available data label positions for this chart type. |
|
48
|
13
|
|
|
|
|
26
|
$self->{_label_position_default} = 'right'; |
|
49
|
|
|
|
|
|
|
$self->{_label_positions} = { |
|
50
|
13
|
|
|
|
|
92
|
center => 'ctr', |
|
51
|
|
|
|
|
|
|
right => 'r', |
|
52
|
|
|
|
|
|
|
left => 'l', |
|
53
|
|
|
|
|
|
|
above => 't', |
|
54
|
|
|
|
|
|
|
below => 'b', |
|
55
|
|
|
|
|
|
|
# For backward compatibility. |
|
56
|
|
|
|
|
|
|
top => 't', |
|
57
|
|
|
|
|
|
|
bottom => 'b', |
|
58
|
|
|
|
|
|
|
}; |
|
59
|
|
|
|
|
|
|
|
|
60
|
13
|
|
|
|
|
33
|
bless $self, $class; |
|
61
|
13
|
|
|
|
|
49
|
return $self; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
############################################################################## |
|
66
|
|
|
|
|
|
|
# |
|
67
|
|
|
|
|
|
|
# _write_chart_type() |
|
68
|
|
|
|
|
|
|
# |
|
69
|
|
|
|
|
|
|
# Override the virtual superclass method with a chart specific method. |
|
70
|
|
|
|
|
|
|
# |
|
71
|
|
|
|
|
|
|
sub _write_chart_type { |
|
72
|
|
|
|
|
|
|
|
|
73
|
24
|
|
|
24
|
|
45
|
my $self = shift; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# Write the c:stockChart element. |
|
76
|
24
|
|
|
|
|
59
|
$self->_write_stock_chart( @_ ); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
############################################################################## |
|
81
|
|
|
|
|
|
|
# |
|
82
|
|
|
|
|
|
|
# _write_stock_chart() |
|
83
|
|
|
|
|
|
|
# |
|
84
|
|
|
|
|
|
|
# Write the element. |
|
85
|
|
|
|
|
|
|
# Overridden to add hi_low_lines(). TODO. Refactor up into the SUPER class. |
|
86
|
|
|
|
|
|
|
# |
|
87
|
|
|
|
|
|
|
sub _write_stock_chart { |
|
88
|
|
|
|
|
|
|
|
|
89
|
24
|
|
|
24
|
|
46
|
my $self = shift; |
|
90
|
24
|
|
|
|
|
65
|
my %args = @_; |
|
91
|
|
|
|
|
|
|
|
|
92
|
24
|
|
|
|
|
35
|
my @series; |
|
93
|
24
|
100
|
|
|
|
82
|
if ( $args{primary_axes} ) { |
|
94
|
12
|
|
|
|
|
80
|
@series = $self->_get_primary_axes_series; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
else { |
|
97
|
12
|
|
|
|
|
92
|
@series = $self->_get_secondary_axes_series; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
24
|
100
|
|
|
|
110
|
return unless scalar @series; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# Add default formatting to the series data. |
|
103
|
13
|
|
|
|
|
63
|
$self->_modify_series_formatting(); |
|
104
|
|
|
|
|
|
|
|
|
105
|
13
|
|
|
|
|
55
|
$self->xml_start_tag( 'c:stockChart' ); |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# Write the series elements. |
|
108
|
13
|
|
|
|
|
110
|
$self->_write_ser( $_ ) for @series; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Write the c:dropLines element. |
|
111
|
13
|
|
|
|
|
119
|
$self->_write_drop_lines(); |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# Write the c:hiLowLines element. |
|
114
|
13
|
100
|
|
|
|
95
|
$self->_write_hi_low_lines() if $args{primary_axes}; |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# Write the c:upDownBars element. |
|
117
|
13
|
|
|
|
|
114
|
$self->_write_up_down_bars(); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# Write the c:axId elements |
|
120
|
13
|
|
|
|
|
94
|
$self->_write_axis_ids( %args ); |
|
121
|
|
|
|
|
|
|
|
|
122
|
13
|
|
|
|
|
61
|
$self->xml_end_tag( 'c:stockChart' ); |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
############################################################################## |
|
127
|
|
|
|
|
|
|
# |
|
128
|
|
|
|
|
|
|
# _modify_series_formatting() |
|
129
|
|
|
|
|
|
|
# |
|
130
|
|
|
|
|
|
|
# Add default formatting to the series data. |
|
131
|
|
|
|
|
|
|
# |
|
132
|
|
|
|
|
|
|
sub _modify_series_formatting { |
|
133
|
|
|
|
|
|
|
|
|
134
|
13
|
|
|
13
|
|
33
|
my $self = shift; |
|
135
|
|
|
|
|
|
|
|
|
136
|
13
|
|
|
|
|
23
|
my $index = 0; |
|
137
|
13
|
|
|
|
|
29
|
for my $series ( @{ $self->{_series} } ) { |
|
|
13
|
|
|
|
|
30
|
|
|
138
|
39
|
50
|
|
|
|
89
|
if ( $index % 4 != 3 ) { |
|
139
|
39
|
100
|
|
|
|
109
|
if ( !$series->{_line}->{_defined} ) { |
|
140
|
|
|
|
|
|
|
$series->{_line} = { |
|
141
|
36
|
|
|
|
|
141
|
width => 2.25, |
|
142
|
|
|
|
|
|
|
none => 1, |
|
143
|
|
|
|
|
|
|
_defined => 1, |
|
144
|
|
|
|
|
|
|
}; |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
39
|
100
|
|
|
|
86
|
if ( !$series->{_marker} ) { |
|
148
|
36
|
100
|
|
|
|
84
|
if ( $index % 4 == 2 ) { |
|
149
|
12
|
|
|
|
|
42
|
$series->{_marker} = { type => 'dot', size => 3 }; |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
else { |
|
152
|
24
|
|
|
|
|
67
|
$series->{_marker} = { type => 'none' }; |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
} |
|
157
|
39
|
|
|
|
|
73
|
$index++; |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
1; |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
__END__ |