line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Excel::Writer::XLSX::Chart::Doughnut; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Doughnut - A class for writing Excel Doughnut 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
|
11
|
|
|
11
|
|
223
|
use 5.008002; |
|
11
|
|
|
|
|
44
|
|
19
|
11
|
|
|
11
|
|
59
|
use strict; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
234
|
|
20
|
11
|
|
|
11
|
|
51
|
use warnings; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
305
|
|
21
|
11
|
|
|
11
|
|
89
|
use Carp; |
|
11
|
|
|
|
|
46
|
|
|
11
|
|
|
|
|
805
|
|
22
|
11
|
|
|
11
|
|
5601
|
use Excel::Writer::XLSX::Chart::Pie; |
|
11
|
|
|
|
|
29
|
|
|
11
|
|
|
|
|
3977
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @ISA = qw(Excel::Writer::XLSX::Chart::Pie); |
25
|
|
|
|
|
|
|
our $VERSION = '1.03'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
############################################################################### |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
# new() |
31
|
|
|
|
|
|
|
# |
32
|
|
|
|
|
|
|
# |
33
|
|
|
|
|
|
|
sub new { |
34
|
|
|
|
|
|
|
|
35
|
11
|
|
|
11
|
0
|
29
|
my $class = shift; |
36
|
11
|
|
|
|
|
49
|
my $self = Excel::Writer::XLSX::Chart::Pie->new( @_ ); |
37
|
|
|
|
|
|
|
|
38
|
11
|
|
|
|
|
76
|
$self->{_vary_data_color} = 1; |
39
|
11
|
|
|
|
|
24
|
$self->{_hole_size} = 50; |
40
|
11
|
|
|
|
|
28
|
$self->{_rotation} = 0; |
41
|
|
|
|
|
|
|
|
42
|
11
|
|
|
|
|
25
|
bless $self, $class; |
43
|
11
|
|
|
|
|
43
|
return $self; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
############################################################################### |
48
|
|
|
|
|
|
|
# |
49
|
|
|
|
|
|
|
# set_hole_size() |
50
|
|
|
|
|
|
|
# |
51
|
|
|
|
|
|
|
# Set the Doughnut chart hole size. |
52
|
|
|
|
|
|
|
# |
53
|
|
|
|
|
|
|
sub set_hole_size { |
54
|
|
|
|
|
|
|
|
55
|
2
|
|
|
2
|
1
|
12
|
my $self = shift; |
56
|
2
|
|
|
|
|
4
|
my $size = shift; |
57
|
|
|
|
|
|
|
|
58
|
2
|
50
|
|
|
|
20
|
return if !defined $size; |
59
|
|
|
|
|
|
|
|
60
|
2
|
50
|
33
|
|
|
12
|
if ( $size >= 10 && $size <= 90 ) { |
61
|
2
|
|
|
|
|
8
|
$self->{_hole_size} = $size; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
else { |
64
|
0
|
|
|
|
|
0
|
carp "Hole size $size outside Excel range: 10 <= size <= 90"; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
############################################################################## |
70
|
|
|
|
|
|
|
# |
71
|
|
|
|
|
|
|
# _write_chart_type() |
72
|
|
|
|
|
|
|
# |
73
|
|
|
|
|
|
|
# Override the virtual superclass method with a chart specific method. |
74
|
|
|
|
|
|
|
# |
75
|
|
|
|
|
|
|
sub _write_chart_type { |
76
|
|
|
|
|
|
|
|
77
|
11
|
|
|
11
|
|
21
|
my $self = shift; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# Write the c:doughnutChart element. |
80
|
11
|
|
|
|
|
46
|
$self->_write_doughnut_chart( @_ ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
############################################################################## |
85
|
|
|
|
|
|
|
# |
86
|
|
|
|
|
|
|
# _write_doughnut_chart() |
87
|
|
|
|
|
|
|
# |
88
|
|
|
|
|
|
|
# Write the element. Over-ridden method to remove axis_id code |
89
|
|
|
|
|
|
|
# since Doughnut charts don't require val and cat axes. |
90
|
|
|
|
|
|
|
# |
91
|
|
|
|
|
|
|
sub _write_doughnut_chart { |
92
|
|
|
|
|
|
|
|
93
|
11
|
|
|
11
|
|
29
|
my $self = shift; |
94
|
|
|
|
|
|
|
|
95
|
11
|
|
|
|
|
53
|
$self->xml_start_tag( 'c:doughnutChart' ); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Write the c:varyColors element. |
98
|
11
|
|
|
|
|
112
|
$self->_write_vary_colors(); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# Write the series elements. |
101
|
11
|
|
|
|
|
20
|
$self->_write_ser( $_ ) for @{ $self->{_series} }; |
|
11
|
|
|
|
|
118
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# Write the c:firstSliceAng element. |
104
|
11
|
|
|
|
|
132
|
$self->_write_first_slice_ang(); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# Write the c:holeSize element. |
107
|
11
|
|
|
|
|
42
|
$self->_write_hole_size(); |
108
|
|
|
|
|
|
|
|
109
|
11
|
|
|
|
|
45
|
$self->xml_end_tag( 'c:doughnutChart' ); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
############################################################################## |
114
|
|
|
|
|
|
|
# |
115
|
|
|
|
|
|
|
# _write_hole_size() |
116
|
|
|
|
|
|
|
# |
117
|
|
|
|
|
|
|
# Write the element. |
118
|
|
|
|
|
|
|
# |
119
|
|
|
|
|
|
|
sub _write_hole_size { |
120
|
|
|
|
|
|
|
|
121
|
11
|
|
|
11
|
|
37
|
my $self = shift; |
122
|
11
|
|
|
|
|
33
|
my $val = $self->{_hole_size}; |
123
|
|
|
|
|
|
|
|
124
|
11
|
|
|
|
|
32
|
my @attributes = ( 'val' => $val ); |
125
|
|
|
|
|
|
|
|
126
|
11
|
|
|
|
|
32
|
$self->xml_empty_tag( 'c:holeSize', @attributes ); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
1; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
__END__ |