write_xlsx 0.74.0 → 0.75.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes +5 -0
- data/README.md +1 -1
- data/lib/write_xlsx/chart.rb +28 -24
- data/lib/write_xlsx/chart/axis.rb +2 -1
- data/lib/write_xlsx/chart/pie.rb +20 -10
- data/lib/write_xlsx/version.rb +1 -1
- data/test/helper.rb +11 -3
- data/test/regression/test_chart_axis33.rb +45 -0
- data/test/regression/test_chart_axis34.rb +44 -0
- data/test/regression/test_chart_font09.rb +44 -0
- data/test/regression/test_chart_pie02.rb +38 -0
- data/test/regression/test_chart_pie03.rb +38 -0
- data/test/regression/test_chart_pie04.rb +38 -0
- data/test/regression/xlsx_files/chart_axis33.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis34.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font09.xlsx +0 -0
- data/test/regression/xlsx_files/chart_pie02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_pie03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_pie04.xlsx +0 -0
- metadata +36 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0997fd3d0c045f87a2365cf8c5bf998f694e31f6
|
4
|
+
data.tar.gz: 67ccbdd8857b463def4dadc4f74c1a9a62081a5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f817c43fcea5bd1939dd88204c6b9acbf5609e2b8354f82d9eca8dae9e4e168c4ea94d41d1d14f2ce6e6b01212eff7e9b777e9790ab9794443ea068e9f1688b
|
7
|
+
data.tar.gz: 6b4242ad09a7059121741ef4a67f0b2b01cf66f9de4c6a8dfb461b07026ccc5a9babc729766837c92a93fb25fc11d4788e3cc02b5595cc374a174c6603956bb5
|
data/Changes
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
Change history of write_xlsx rubygem.
|
2
2
|
|
3
|
+
2013-12-09 v0.75.0
|
4
|
+
Added interval unit option for category axes.
|
5
|
+
Fix for axis name font rotation.
|
6
|
+
Fix for several minor issues with Pie chart legends.
|
7
|
+
|
3
8
|
2013-11-18 v0.74.0
|
4
9
|
Improved defined name validation.
|
5
10
|
Allow utf8 character etc.
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
gem to create a new file in the Excel 2007+ XLSX format, and you can use the
|
4
4
|
same interface as writeexcel gem. write_xlsx is converted from Perl's module
|
5
|
-
[Excel::Writer::XLSX-0.
|
5
|
+
[Excel::Writer::XLSX-0.75](https://github.com/jmcnamara/excel-writer-xlsx) .
|
6
6
|
|
7
7
|
## Description
|
8
8
|
|
data/lib/write_xlsx/chart.rb
CHANGED
@@ -1195,6 +1195,8 @@ def write_cat_axis(params) # :nodoc:
|
|
1195
1195
|
write_label_align('ctr')
|
1196
1196
|
# Write the c:labelOffset element.
|
1197
1197
|
write_label_offset(100)
|
1198
|
+
# Write the c:tickLblSkip element.
|
1199
|
+
write_tick_lbl_skip(x_axis.interval_unit)
|
1198
1200
|
end
|
1199
1201
|
end
|
1200
1202
|
|
@@ -1343,6 +1345,8 @@ def write_date_axis(params) # :nodoc:
|
|
1343
1345
|
write_auto(1)
|
1344
1346
|
# Write the c:labelOffset element.
|
1345
1347
|
write_label_offset(100)
|
1348
|
+
# Write the c:tickLblSkip element.
|
1349
|
+
write_tick_lbl_skip(x_axis.interval_unit)
|
1346
1350
|
# Write the c:majorUnit element.
|
1347
1351
|
write_c_major_unit(x_axis.major_unit)
|
1348
1352
|
# Write the c:majorTimeUnit element.
|
@@ -1522,6 +1526,15 @@ def write_label_offset(val) # :nodoc:
|
|
1522
1526
|
@writer.empty_tag('c:lblOffset', [ ['val', val] ])
|
1523
1527
|
end
|
1524
1528
|
|
1529
|
+
#
|
1530
|
+
# Write the <c:tickLblSkip> element.
|
1531
|
+
#
|
1532
|
+
def write_tick_lbl_skip(val) # :nodoc:
|
1533
|
+
return unless val
|
1534
|
+
|
1535
|
+
@writer.empty_tag('c:tickLblSkip', [ ['val', val] ])
|
1536
|
+
end
|
1537
|
+
|
1525
1538
|
#
|
1526
1539
|
# Write the <c:majorGridlines> element.
|
1527
1540
|
#
|
@@ -1788,9 +1801,13 @@ def write_tx_formula(title, data_id) # :nodoc:
|
|
1788
1801
|
# Write the <c:rich> element.
|
1789
1802
|
#
|
1790
1803
|
def write_rich(title, horiz) # :nodoc:
|
1804
|
+
rotation = nil
|
1805
|
+
if title.name_font && title.name_font[:_rotation]
|
1806
|
+
rotation = title.name_font[:_rotation]
|
1807
|
+
end
|
1791
1808
|
@writer.tag_elements('c:rich') do
|
1792
1809
|
# Write the a:bodyPr element.
|
1793
|
-
write_a_body_pr(horiz)
|
1810
|
+
write_a_body_pr(rotation, horiz)
|
1794
1811
|
# Write the a:lstStyle element.
|
1795
1812
|
write_a_lst_style
|
1796
1813
|
# Write the a:p element.
|
@@ -1801,28 +1818,11 @@ def write_rich(title, horiz) # :nodoc:
|
|
1801
1818
|
#
|
1802
1819
|
# Write the <a:bodyPr> element.
|
1803
1820
|
#
|
1804
|
-
def write_a_body_pr(horiz) # :nodoc:
|
1805
|
-
rot
|
1806
|
-
vert = 'horz'
|
1807
|
-
|
1808
|
-
attributes = [
|
1809
|
-
['rot', rot],
|
1810
|
-
['vert', vert]
|
1811
|
-
]
|
1812
|
-
|
1813
|
-
attributes = [] unless ptrue?(horiz)
|
1814
|
-
|
1815
|
-
@writer.empty_tag('a:bodyPr', attributes)
|
1816
|
-
end
|
1817
|
-
|
1818
|
-
#
|
1819
|
-
# Write the <a:bodyPr> element for axis fonts.
|
1820
|
-
#
|
1821
|
-
def write_axis_body_pr(rot = nil, vert = nil)
|
1821
|
+
def write_a_body_pr(rot, horiz = nil) # :nodoc:
|
1822
|
+
rot = -5400000 if !rot && ptrue?(horiz)
|
1822
1823
|
attributes = []
|
1823
|
-
|
1824
|
-
attributes << ['
|
1825
|
-
attributes << ['vert', vert] if vert
|
1824
|
+
attributes << ['rot', rot] if rot
|
1825
|
+
attributes << ['vert', 'horz'] if ptrue?(horiz)
|
1826
1826
|
|
1827
1827
|
@writer.empty_tag('a:bodyPr', attributes)
|
1828
1828
|
end
|
@@ -1941,9 +1941,13 @@ def write_a_t(title) # :nodoc:
|
|
1941
1941
|
# Write the <c:txPr> element.
|
1942
1942
|
#
|
1943
1943
|
def write_tx_pr(horiz, font) # :nodoc:
|
1944
|
+
rotation = nil
|
1945
|
+
if font && font[:_rotation]
|
1946
|
+
rotation = font[:_rotation]
|
1947
|
+
end
|
1944
1948
|
@writer.tag_elements('c:txPr') do
|
1945
1949
|
# Write the a:bodyPr element.
|
1946
|
-
write_a_body_pr(horiz)
|
1950
|
+
write_a_body_pr(rotation, horiz)
|
1947
1951
|
# Write the a:lstStyle element.
|
1948
1952
|
write_a_lst_style
|
1949
1953
|
# Write the a:p element.
|
@@ -2394,7 +2398,7 @@ def write_axis_font(font) # :nodoc:
|
|
2394
2398
|
return unless font
|
2395
2399
|
|
2396
2400
|
@writer.tag_elements('c:txPr') do
|
2397
|
-
|
2401
|
+
write_a_body_pr(font[:_rotation])
|
2398
2402
|
write_a_lst_style
|
2399
2403
|
@writer.tag_elements('a:p') do
|
2400
2404
|
write_a_p_pr_rich(font)
|
@@ -12,7 +12,7 @@ class Axis < Caption
|
|
12
12
|
attr_accessor :min, :max
|
13
13
|
attr_accessor :minor_unit, :major_unit, :minor_unit_type, :major_unit_type
|
14
14
|
attr_accessor :log_base, :crossing, :position, :position_axis, :label_position, :visible
|
15
|
-
attr_accessor :num_format, :num_format_linked, :num_font, :layout
|
15
|
+
attr_accessor :num_format, :num_format_linked, :num_font, :layout, :interval_unit
|
16
16
|
attr_accessor :major_gridlines, :minor_gridlines, :major_tick_mark
|
17
17
|
|
18
18
|
#
|
@@ -35,6 +35,7 @@ def merge_with_hash(params) # :nodoc:
|
|
35
35
|
@label_position = args[:label_position]
|
36
36
|
@num_format = args[:num_format]
|
37
37
|
@num_format_linked = args[:num_format_linked]
|
38
|
+
@interval_unit = args[:interval_unit]
|
38
39
|
@visible = args[:visible] || 1
|
39
40
|
|
40
41
|
# Map major/minor_gridlines properties.
|
data/lib/write_xlsx/chart/pie.rb
CHANGED
@@ -76,10 +76,12 @@ def write_plot_area
|
|
76
76
|
#
|
77
77
|
def write_legend
|
78
78
|
position = @legend_position
|
79
|
+
font = @legend_font
|
79
80
|
overlay = 0
|
81
|
+
delete_series = @legend_delete_series || []
|
80
82
|
|
81
83
|
if position =~ /^overlay_/
|
82
|
-
|
84
|
+
position.sub!(/^overlay_/, '')
|
83
85
|
overlay = 1
|
84
86
|
end
|
85
87
|
|
@@ -98,38 +100,46 @@ def write_legend
|
|
98
100
|
@writer.tag_elements('c:legend') do
|
99
101
|
# Write the c:legendPos element.
|
100
102
|
write_legend_pos(position)
|
103
|
+
# Remove series labels from the legend.
|
104
|
+
delete_series.each do |index|
|
105
|
+
# Write the c:legendEntry element.
|
106
|
+
write_legend_entry(index)
|
107
|
+
end
|
101
108
|
# Write the c:layout element.
|
102
109
|
write_layout(@legend_layout, 'legend')
|
103
110
|
# Write the c:overlay element.
|
104
111
|
write_overlay if overlay != 0
|
105
112
|
# Write the c:txPr element. Over-ridden.
|
106
|
-
write_tx_pr_legend
|
113
|
+
write_tx_pr_legend(0, font)
|
107
114
|
end
|
108
115
|
end
|
109
116
|
|
110
117
|
#
|
111
118
|
# Write the <c:txPr> element for legends.
|
112
119
|
#
|
113
|
-
def write_tx_pr_legend
|
114
|
-
|
120
|
+
def write_tx_pr_legend(horiz, font)
|
121
|
+
rotation = nil
|
122
|
+
if ptrue?(font) && font[:_rotation]
|
123
|
+
rotation = font[:_rotation]
|
124
|
+
end
|
115
125
|
|
116
126
|
@writer.tag_elements('c:txPr') do
|
117
127
|
# Write the a:bodyPr element.
|
118
|
-
write_a_body_pr(horiz)
|
128
|
+
write_a_body_pr(rotation, horiz)
|
119
129
|
# Write the a:lstStyle element.
|
120
130
|
write_a_lst_style
|
121
131
|
# Write the a:p element.
|
122
|
-
write_a_p_legend
|
132
|
+
write_a_p_legend(font)
|
123
133
|
end
|
124
134
|
end
|
125
135
|
|
126
136
|
#
|
127
137
|
# Write the <a:p> element for legends.
|
128
138
|
#
|
129
|
-
def write_a_p_legend
|
139
|
+
def write_a_p_legend(font)
|
130
140
|
@writer.tag_elements('a:p') do
|
131
141
|
# Write the a:pPr element.
|
132
|
-
write_a_p_pr_legend
|
142
|
+
write_a_p_pr_legend(font)
|
133
143
|
# Write the a:endParaRPr element.
|
134
144
|
write_a_end_para_rpr
|
135
145
|
end
|
@@ -138,14 +148,14 @@ def write_a_p_legend
|
|
138
148
|
#
|
139
149
|
# Write the <a:pPr> element for legends.
|
140
150
|
#
|
141
|
-
def write_a_p_pr_legend
|
151
|
+
def write_a_p_pr_legend(font)
|
142
152
|
rtl = 0
|
143
153
|
|
144
154
|
attributes = [ ['rtl', rtl] ]
|
145
155
|
|
146
156
|
@writer.tag_elements('a:pPr', attributes) do
|
147
157
|
# Write the a:defRPr element.
|
148
|
-
write_a_def_rpr
|
158
|
+
write_a_def_rpr(font)
|
149
159
|
end
|
150
160
|
end
|
151
161
|
|
data/lib/write_xlsx/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -95,9 +95,17 @@ def compare_xlsx(exp_filename, got_filename, ignore_members = nil, ignore_elemen
|
|
95
95
|
|
96
96
|
# Compare each file in the XLSX containers.
|
97
97
|
exp_members.each_index do |i|
|
98
|
-
|
99
|
-
|
100
|
-
|
98
|
+
begin
|
99
|
+
got_str = got_members[i].get_input_stream.read
|
100
|
+
got_xml_str = got_str.gsub(%r!(\S)/>!, '\1 />')
|
101
|
+
# exp_xml_str = exp_members[i].get_input_stream.read.gsub(%r!(\S)/>!, '\1 />')
|
102
|
+
exp_str = exp_members[i].get_input_stream.read
|
103
|
+
exp_str.force_encoding("ASCII-8BIT") if got_str.encoding == Encoding::ASCII_8BIT
|
104
|
+
exp_xml_str = exp_str.gsub(%r!(\S)/>!, '\1 />')
|
105
|
+
rescue
|
106
|
+
p got_str.encoding
|
107
|
+
p exp_str.encoding
|
108
|
+
end
|
101
109
|
# Remove dates and user specific data from the core.xml data.
|
102
110
|
if exp_members[i].name == 'docProps/core.xml'
|
103
111
|
if regression
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartAxis33 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_axis33
|
14
|
+
@xlsx = 'chart_axis33.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'line', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [68827008, 68898816])
|
21
|
+
data = [
|
22
|
+
[ 1, 2, 3, 4, 5 ],
|
23
|
+
[ 2, 4, 6, 8, 10 ],
|
24
|
+
[ 3, 6, 9, 12, 15 ]
|
25
|
+
]
|
26
|
+
|
27
|
+
worksheet.write('A1', data)
|
28
|
+
|
29
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
30
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
32
|
+
|
33
|
+
chart.set_x_axis(:name => 'XXX', :name_font => { :rotation => -45, :baseline => -1 })
|
34
|
+
chart.set_y_axis(:name => 'YYY', :name_font => { :rotation => -45, :baseline => -1 })
|
35
|
+
|
36
|
+
worksheet.insert_chart('E9', chart)
|
37
|
+
|
38
|
+
workbook.close
|
39
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx),
|
40
|
+
@xlsx,
|
41
|
+
nil,
|
42
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
43
|
+
)
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartAxis34 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_axis34
|
14
|
+
@xlsx = 'chart_axis34.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'line', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [54712192, 54713728])
|
21
|
+
data = [
|
22
|
+
[ 1, 2, 3, 4, 5 ],
|
23
|
+
[ 2, 4, 6, 8, 10 ],
|
24
|
+
[ 3, 6, 9, 12, 15 ]
|
25
|
+
]
|
26
|
+
|
27
|
+
worksheet.write('A1', data)
|
28
|
+
|
29
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
30
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
32
|
+
|
33
|
+
chart.set_x_axis(:interval_unit => 2)
|
34
|
+
|
35
|
+
worksheet.insert_chart('E9', chart)
|
36
|
+
|
37
|
+
workbook.close
|
38
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx),
|
39
|
+
@xlsx,
|
40
|
+
nil,
|
41
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartFont09 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_font09
|
14
|
+
@xlsx = 'chart_font09.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'bar', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [68825472, 68827392])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[1, 2, 3, 4, 5],
|
24
|
+
[2, 4, 6, 8, 10],
|
25
|
+
[3, 6, 9, 12, 15]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_title(:name => 'Title', :name_font => {:rotation => -45, :baseline => -1})
|
35
|
+
|
36
|
+
worksheet.insert_chart('E9', chart)
|
37
|
+
|
38
|
+
workbook.close
|
39
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
40
|
+
nil,
|
41
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartPie02 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_pie02
|
14
|
+
@xlsx = 'chart_pie02.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'pie', :embedded => 1)
|
18
|
+
|
19
|
+
data = [
|
20
|
+
[ 2, 4, 6],
|
21
|
+
[60, 30, 10]
|
22
|
+
]
|
23
|
+
|
24
|
+
worksheet.write('A1', data)
|
25
|
+
|
26
|
+
chart.add_series(
|
27
|
+
:categories => '=Sheet1!$A$1:$A$3',
|
28
|
+
:values => '=Sheet1!$B$1:$B$3'
|
29
|
+
)
|
30
|
+
|
31
|
+
chart.set_legend(:font => {:bold => 1, :italic => 1, :baseline => -1})
|
32
|
+
|
33
|
+
worksheet.insert_chart('E9', chart)
|
34
|
+
|
35
|
+
workbook.close
|
36
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartPie03 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_pie03
|
14
|
+
@xlsx = 'chart_pie03.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'pie', :embedded => 1)
|
18
|
+
|
19
|
+
data = [
|
20
|
+
[ 2, 4, 6],
|
21
|
+
[60, 30, 10]
|
22
|
+
]
|
23
|
+
|
24
|
+
worksheet.write('A1', data)
|
25
|
+
|
26
|
+
chart.add_series(
|
27
|
+
:categories => '=Sheet1!$A$1:$A$3',
|
28
|
+
:values => '=Sheet1!$B$1:$B$3'
|
29
|
+
)
|
30
|
+
|
31
|
+
chart.set_legend(:delete_series => [1])
|
32
|
+
|
33
|
+
worksheet.insert_chart('E9', chart)
|
34
|
+
|
35
|
+
workbook.close
|
36
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartPie04 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_pie04
|
14
|
+
@xlsx = 'chart_pie04.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'pie', :embedded => 1)
|
18
|
+
|
19
|
+
data = [
|
20
|
+
[ 2, 4, 6],
|
21
|
+
[60, 30, 10]
|
22
|
+
]
|
23
|
+
|
24
|
+
worksheet.write('A1', data)
|
25
|
+
|
26
|
+
chart.add_series(
|
27
|
+
:categories => '=Sheet1!$A$1:$A$3',
|
28
|
+
:values => '=Sheet1!$B$1:$B$3'
|
29
|
+
)
|
30
|
+
|
31
|
+
chart.set_legend(:position => 'overlay_right')
|
32
|
+
|
33
|
+
worksheet.insert_chart('E9', chart)
|
34
|
+
|
35
|
+
workbook.close
|
36
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
37
|
+
end
|
38
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: write_xlsx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.75.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hideo NAKAMURA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: simplecov
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: write_xlsx is a gem to create a new file in the Excel 2007+ XLSX format.
|
@@ -49,9 +49,9 @@ extra_rdoc_files:
|
|
49
49
|
- README.md
|
50
50
|
- Changes
|
51
51
|
files:
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
52
|
+
- .document
|
53
|
+
- .gitattributes
|
54
|
+
- .gitignore
|
55
55
|
- Changes
|
56
56
|
- Gemfile
|
57
57
|
- LICENSE.txt
|
@@ -401,6 +401,8 @@ files:
|
|
401
401
|
- test/regression/test_chart_axis30.rb
|
402
402
|
- test/regression/test_chart_axis31.rb
|
403
403
|
- test/regression/test_chart_axis32.rb
|
404
|
+
- test/regression/test_chart_axis33.rb
|
405
|
+
- test/regression/test_chart_axis34.rb
|
404
406
|
- test/regression/test_chart_bar01.rb
|
405
407
|
- test/regression/test_chart_bar02.rb
|
406
408
|
- test/regression/test_chart_bar03.rb
|
@@ -468,6 +470,7 @@ files:
|
|
468
470
|
- test/regression/test_chart_font06.rb
|
469
471
|
- test/regression/test_chart_font07.rb
|
470
472
|
- test/regression/test_chart_font08.rb
|
473
|
+
- test/regression/test_chart_font09.rb
|
471
474
|
- test/regression/test_chart_format01.rb
|
472
475
|
- test/regression/test_chart_format02.rb
|
473
476
|
- test/regression/test_chart_format03.rb
|
@@ -519,6 +522,9 @@ files:
|
|
519
522
|
- test/regression/test_chart_order02.rb
|
520
523
|
- test/regression/test_chart_order03.rb
|
521
524
|
- test/regression/test_chart_pie01.rb
|
525
|
+
- test/regression/test_chart_pie02.rb
|
526
|
+
- test/regression/test_chart_pie03.rb
|
527
|
+
- test/regression/test_chart_pie04.rb
|
522
528
|
- test/regression/test_chart_points01.rb
|
523
529
|
- test/regression/test_chart_points02.rb
|
524
530
|
- test/regression/test_chart_points03.rb
|
@@ -840,6 +846,8 @@ files:
|
|
840
846
|
- test/regression/xlsx_files/chart_axis30.xlsx
|
841
847
|
- test/regression/xlsx_files/chart_axis31.xlsx
|
842
848
|
- test/regression/xlsx_files/chart_axis32.xlsx
|
849
|
+
- test/regression/xlsx_files/chart_axis33.xlsx
|
850
|
+
- test/regression/xlsx_files/chart_axis34.xlsx
|
843
851
|
- test/regression/xlsx_files/chart_bar01.xlsx
|
844
852
|
- test/regression/xlsx_files/chart_bar02.xlsx
|
845
853
|
- test/regression/xlsx_files/chart_bar03.xlsx
|
@@ -906,6 +914,7 @@ files:
|
|
906
914
|
- test/regression/xlsx_files/chart_font06.xlsx
|
907
915
|
- test/regression/xlsx_files/chart_font07.xlsx
|
908
916
|
- test/regression/xlsx_files/chart_font08.xlsx
|
917
|
+
- test/regression/xlsx_files/chart_font09.xlsx
|
909
918
|
- test/regression/xlsx_files/chart_format01.xlsx
|
910
919
|
- test/regression/xlsx_files/chart_format02.xlsx
|
911
920
|
- test/regression/xlsx_files/chart_format03.xlsx
|
@@ -955,6 +964,9 @@ files:
|
|
955
964
|
- test/regression/xlsx_files/chart_order01.xlsx
|
956
965
|
- test/regression/xlsx_files/chart_order03.xlsx
|
957
966
|
- test/regression/xlsx_files/chart_pie01.xlsx
|
967
|
+
- test/regression/xlsx_files/chart_pie02.xlsx
|
968
|
+
- test/regression/xlsx_files/chart_pie03.xlsx
|
969
|
+
- test/regression/xlsx_files/chart_pie04.xlsx
|
958
970
|
- test/regression/xlsx_files/chart_points01.xlsx
|
959
971
|
- test/regression/xlsx_files/chart_points02.xlsx
|
960
972
|
- test/regression/xlsx_files/chart_points03.xlsx
|
@@ -1337,17 +1349,17 @@ require_paths:
|
|
1337
1349
|
- lib
|
1338
1350
|
required_ruby_version: !ruby/object:Gem::Requirement
|
1339
1351
|
requirements:
|
1340
|
-
- -
|
1352
|
+
- - '>='
|
1341
1353
|
- !ruby/object:Gem::Version
|
1342
1354
|
version: '0'
|
1343
1355
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1344
1356
|
requirements:
|
1345
|
-
- -
|
1357
|
+
- - '>='
|
1346
1358
|
- !ruby/object:Gem::Version
|
1347
1359
|
version: '0'
|
1348
1360
|
requirements: []
|
1349
1361
|
rubyforge_project:
|
1350
|
-
rubygems_version: 2.
|
1362
|
+
rubygems_version: 2.1.11
|
1351
1363
|
signing_key:
|
1352
1364
|
specification_version: 4
|
1353
1365
|
summary: write_xlsx is a gem to create a new file in the Excel 2007+ XLSX format.
|
@@ -1587,6 +1599,8 @@ test_files:
|
|
1587
1599
|
- test/regression/test_chart_axis30.rb
|
1588
1600
|
- test/regression/test_chart_axis31.rb
|
1589
1601
|
- test/regression/test_chart_axis32.rb
|
1602
|
+
- test/regression/test_chart_axis33.rb
|
1603
|
+
- test/regression/test_chart_axis34.rb
|
1590
1604
|
- test/regression/test_chart_bar01.rb
|
1591
1605
|
- test/regression/test_chart_bar02.rb
|
1592
1606
|
- test/regression/test_chart_bar03.rb
|
@@ -1654,6 +1668,7 @@ test_files:
|
|
1654
1668
|
- test/regression/test_chart_font06.rb
|
1655
1669
|
- test/regression/test_chart_font07.rb
|
1656
1670
|
- test/regression/test_chart_font08.rb
|
1671
|
+
- test/regression/test_chart_font09.rb
|
1657
1672
|
- test/regression/test_chart_format01.rb
|
1658
1673
|
- test/regression/test_chart_format02.rb
|
1659
1674
|
- test/regression/test_chart_format03.rb
|
@@ -1705,6 +1720,9 @@ test_files:
|
|
1705
1720
|
- test/regression/test_chart_order02.rb
|
1706
1721
|
- test/regression/test_chart_order03.rb
|
1707
1722
|
- test/regression/test_chart_pie01.rb
|
1723
|
+
- test/regression/test_chart_pie02.rb
|
1724
|
+
- test/regression/test_chart_pie03.rb
|
1725
|
+
- test/regression/test_chart_pie04.rb
|
1708
1726
|
- test/regression/test_chart_points01.rb
|
1709
1727
|
- test/regression/test_chart_points02.rb
|
1710
1728
|
- test/regression/test_chart_points03.rb
|
@@ -2026,6 +2044,8 @@ test_files:
|
|
2026
2044
|
- test/regression/xlsx_files/chart_axis30.xlsx
|
2027
2045
|
- test/regression/xlsx_files/chart_axis31.xlsx
|
2028
2046
|
- test/regression/xlsx_files/chart_axis32.xlsx
|
2047
|
+
- test/regression/xlsx_files/chart_axis33.xlsx
|
2048
|
+
- test/regression/xlsx_files/chart_axis34.xlsx
|
2029
2049
|
- test/regression/xlsx_files/chart_bar01.xlsx
|
2030
2050
|
- test/regression/xlsx_files/chart_bar02.xlsx
|
2031
2051
|
- test/regression/xlsx_files/chart_bar03.xlsx
|
@@ -2092,6 +2112,7 @@ test_files:
|
|
2092
2112
|
- test/regression/xlsx_files/chart_font06.xlsx
|
2093
2113
|
- test/regression/xlsx_files/chart_font07.xlsx
|
2094
2114
|
- test/regression/xlsx_files/chart_font08.xlsx
|
2115
|
+
- test/regression/xlsx_files/chart_font09.xlsx
|
2095
2116
|
- test/regression/xlsx_files/chart_format01.xlsx
|
2096
2117
|
- test/regression/xlsx_files/chart_format02.xlsx
|
2097
2118
|
- test/regression/xlsx_files/chart_format03.xlsx
|
@@ -2141,6 +2162,9 @@ test_files:
|
|
2141
2162
|
- test/regression/xlsx_files/chart_order01.xlsx
|
2142
2163
|
- test/regression/xlsx_files/chart_order03.xlsx
|
2143
2164
|
- test/regression/xlsx_files/chart_pie01.xlsx
|
2165
|
+
- test/regression/xlsx_files/chart_pie02.xlsx
|
2166
|
+
- test/regression/xlsx_files/chart_pie03.xlsx
|
2167
|
+
- test/regression/xlsx_files/chart_pie04.xlsx
|
2144
2168
|
- test/regression/xlsx_files/chart_points01.xlsx
|
2145
2169
|
- test/regression/xlsx_files/chart_points02.xlsx
|
2146
2170
|
- test/regression/xlsx_files/chart_points03.xlsx
|
@@ -2513,4 +2537,3 @@ test_files:
|
|
2513
2537
|
- test/worksheet/test_write_tab_color.rb
|
2514
2538
|
- test/worksheet/test_write_url.rb
|
2515
2539
|
- test/worksheet/test_write_worksheet_attributes.rb
|
2516
|
-
has_rdoc:
|