| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Excel::Writer::XLSX::Chart::Line; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Line - A class for writing Excel Line 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-2020, 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
|
88
|
|
|
88
|
|
6374
|
use 5.008002; |
|
|
88
|
|
|
|
|
298
|
|
|
19
|
88
|
|
|
88
|
|
450
|
use strict; |
|
|
88
|
|
|
|
|
159
|
|
|
|
88
|
|
|
|
|
1716
|
|
|
20
|
88
|
|
|
88
|
|
420
|
use warnings; |
|
|
88
|
|
|
|
|
162
|
|
|
|
88
|
|
|
|
|
2037
|
|
|
21
|
88
|
|
|
88
|
|
379
|
use Carp; |
|
|
88
|
|
|
|
|
162
|
|
|
|
88
|
|
|
|
|
4925
|
|
|
22
|
88
|
|
|
88
|
|
505
|
use Excel::Writer::XLSX::Chart; |
|
|
88
|
|
|
|
|
182
|
|
|
|
88
|
|
|
|
|
45724
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @ISA = qw(Excel::Writer::XLSX::Chart); |
|
25
|
|
|
|
|
|
|
our $VERSION = '1.07'; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
############################################################################### |
|
29
|
|
|
|
|
|
|
# |
|
30
|
|
|
|
|
|
|
# new() |
|
31
|
|
|
|
|
|
|
# |
|
32
|
|
|
|
|
|
|
# |
|
33
|
|
|
|
|
|
|
sub new { |
|
34
|
|
|
|
|
|
|
|
|
35
|
91
|
|
|
91
|
0
|
1611
|
my $class = shift; |
|
36
|
91
|
|
|
|
|
391
|
my $self = Excel::Writer::XLSX::Chart->new( @_ ); |
|
37
|
|
|
|
|
|
|
|
|
38
|
91
|
|
100
|
|
|
511
|
$self->{_subtype} = $self->{_subtype} || 'standard'; |
|
39
|
91
|
|
|
|
|
278
|
$self->{_default_marker} = { type => 'none' }; |
|
40
|
91
|
|
|
|
|
196
|
$self->{_smooth_allowed} = 1; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Override and reset the default axis values. |
|
43
|
91
|
100
|
|
|
|
347
|
if ( $self->{_subtype} eq 'percent_stacked' ) { |
|
44
|
1
|
|
|
|
|
2
|
$self->{_y_axis}->{_defaults}->{num_format} = '0%'; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
91
|
|
|
|
|
341
|
$self->set_y_axis(); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Set the available data label positions for this chart type. |
|
50
|
91
|
|
|
|
|
194
|
$self->{_label_position_default} = 'right'; |
|
51
|
|
|
|
|
|
|
$self->{_label_positions} = { |
|
52
|
91
|
|
|
|
|
527
|
center => 'ctr', |
|
53
|
|
|
|
|
|
|
right => 'r', |
|
54
|
|
|
|
|
|
|
left => 'l', |
|
55
|
|
|
|
|
|
|
above => 't', |
|
56
|
|
|
|
|
|
|
below => 'b', |
|
57
|
|
|
|
|
|
|
# For backward compatibility. |
|
58
|
|
|
|
|
|
|
top => 't', |
|
59
|
|
|
|
|
|
|
bottom => 'b', |
|
60
|
|
|
|
|
|
|
}; |
|
61
|
|
|
|
|
|
|
|
|
62
|
91
|
|
|
|
|
208
|
bless $self, $class; |
|
63
|
91
|
|
|
|
|
306
|
return $self; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
############################################################################## |
|
68
|
|
|
|
|
|
|
# |
|
69
|
|
|
|
|
|
|
# _write_chart_type() |
|
70
|
|
|
|
|
|
|
# |
|
71
|
|
|
|
|
|
|
# Override the virtual superclass method with a chart specific method. |
|
72
|
|
|
|
|
|
|
# |
|
73
|
|
|
|
|
|
|
sub _write_chart_type { |
|
74
|
|
|
|
|
|
|
|
|
75
|
178
|
|
|
178
|
|
351
|
my $self = shift; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Write the c:lineChart element. |
|
78
|
178
|
|
|
|
|
528
|
$self->_write_line_chart( @_ ); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
############################################################################## |
|
83
|
|
|
|
|
|
|
# |
|
84
|
|
|
|
|
|
|
# _write_line_chart() |
|
85
|
|
|
|
|
|
|
# |
|
86
|
|
|
|
|
|
|
# Write the element. |
|
87
|
|
|
|
|
|
|
# |
|
88
|
|
|
|
|
|
|
sub _write_line_chart { |
|
89
|
|
|
|
|
|
|
|
|
90
|
178
|
|
|
178
|
|
320
|
my $self = shift; |
|
91
|
178
|
|
|
|
|
500
|
my %args = @_; |
|
92
|
|
|
|
|
|
|
|
|
93
|
178
|
|
|
|
|
349
|
my @series; |
|
94
|
178
|
100
|
|
|
|
591
|
if ( $args{primary_axes} ) { |
|
95
|
89
|
|
|
|
|
747
|
@series = $self->_get_primary_axes_series; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
else { |
|
98
|
89
|
|
|
|
|
628
|
@series = $self->_get_secondary_axes_series; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
178
|
100
|
|
|
|
660
|
return unless scalar @series; |
|
102
|
|
|
|
|
|
|
|
|
103
|
90
|
|
|
|
|
277
|
my $subtype = $self->{_subtype}; |
|
104
|
|
|
|
|
|
|
|
|
105
|
90
|
100
|
|
|
|
428
|
$subtype = 'percentStacked' if $subtype eq 'percent_stacked'; |
|
106
|
|
|
|
|
|
|
|
|
107
|
90
|
|
|
|
|
397
|
$self->xml_start_tag( 'c:lineChart' ); |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# Write the c:grouping element. |
|
110
|
90
|
|
|
|
|
626
|
$self->_write_grouping( $subtype ); |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# Write the series elements. |
|
113
|
90
|
|
|
|
|
604
|
$self->_write_series( $_ ) for @series; |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# Write the c:dropLines element. |
|
116
|
90
|
|
|
|
|
754
|
$self->_write_drop_lines(); |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# Write the c:hiLowLines element. |
|
119
|
90
|
|
|
|
|
655
|
$self->_write_hi_low_lines(); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# Write the c:upDownBars element. |
|
122
|
90
|
|
|
|
|
654
|
$self->_write_up_down_bars(); |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# Write the c:marker element. |
|
125
|
90
|
|
|
|
|
395
|
$self->_write_marker_value(); |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
# Write the c:axId elements |
|
128
|
90
|
|
|
|
|
822
|
$self->_write_axis_ids( %args ); |
|
129
|
|
|
|
|
|
|
|
|
130
|
90
|
|
|
|
|
400
|
$self->xml_end_tag( 'c:lineChart' ); |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
############################################################################## |
|
135
|
|
|
|
|
|
|
# |
|
136
|
|
|
|
|
|
|
# _write_d_pt_point() |
|
137
|
|
|
|
|
|
|
# |
|
138
|
|
|
|
|
|
|
# Write an individual element. Override the parent method to add |
|
139
|
|
|
|
|
|
|
# markers. |
|
140
|
|
|
|
|
|
|
# |
|
141
|
|
|
|
|
|
|
sub _write_d_pt_point { |
|
142
|
|
|
|
|
|
|
|
|
143
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
|
144
|
1
|
|
|
|
|
1
|
my $index = shift; |
|
145
|
1
|
|
|
|
|
2
|
my $point = shift; |
|
146
|
|
|
|
|
|
|
|
|
147
|
1
|
|
|
|
|
14
|
$self->xml_start_tag( 'c:dPt' ); |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# Write the c:idx element. |
|
150
|
1
|
|
|
|
|
4
|
$self->_write_idx( $index ); |
|
151
|
|
|
|
|
|
|
|
|
152
|
1
|
|
|
|
|
4
|
$self->xml_start_tag( 'c:marker' ); |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
# Write the c:spPr element. |
|
155
|
1
|
|
|
|
|
4
|
$self->_write_sp_pr( $point ); |
|
156
|
|
|
|
|
|
|
|
|
157
|
1
|
|
|
|
|
3
|
$self->xml_end_tag( 'c:marker' ); |
|
158
|
|
|
|
|
|
|
|
|
159
|
1
|
|
|
|
|
3
|
$self->xml_end_tag( 'c:dPt' ); |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
############################################################################## |
|
163
|
|
|
|
|
|
|
# |
|
164
|
|
|
|
|
|
|
# _write_marker_value() |
|
165
|
|
|
|
|
|
|
# |
|
166
|
|
|
|
|
|
|
# Write the element without a sub-element. |
|
167
|
|
|
|
|
|
|
# |
|
168
|
|
|
|
|
|
|
sub _write_marker_value { |
|
169
|
|
|
|
|
|
|
|
|
170
|
91
|
|
|
91
|
|
216
|
my $self = shift; |
|
171
|
|
|
|
|
|
|
|
|
172
|
91
|
|
|
|
|
313
|
my @attributes = ( 'val' => 1 ); |
|
173
|
|
|
|
|
|
|
|
|
174
|
91
|
|
|
|
|
389
|
$self->xml_empty_tag( 'c:marker', @attributes ); |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
1; |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
__END__ |